how to restart python script in code code example
Example 1: how to restart program in python
import os
import sys
os.execl(sys.executable, sys.executable, *sys.argv)
Example 2: how to reboot a python script
import os
while 1:
os.system("python main.py")
print "Restarting..."
exit()