python self.restart() code example
Example: how to reboot a python script
import os
while 1:
os.system("python main.py")
print "Restarting..."
exit()
import os
while 1:
os.system("python main.py")
print "Restarting..."
exit()