Here is the Code :
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)
This code will work perfectly fine in python 3.6 but in python 2.7.
How do i restart in python 2.7?