xxxxxxxxxx
import os
while 1:
os.system("python main.py")
print "Restarting..."
exit()
xxxxxxxxxx
sys.stdout.flush()
os.execl(sys.executable, 'python', __file__, *sys.argv[1:])
xxxxxxxxxx
import os
import sys
def restart_program():
python = sys.executable
os.execl(python, python, *sys.argv)
if __name__ == "__main__":
restart_program()