Вот код:
def restartSim():
"""Restarts the current program.
Note: this function does not return. Any cleanup action (like
saving data) must be done before calling this function."""
python = sys.executable
os.execl(python, python, * sys.argv)
Этот код будет отлично работать в Python 3.6, но в Python 2.7.
Как перезапустить в Python 2.7?