os.exec code example
Example: os.execl
import os
import sys
if(input("Would you like to restart?\n") == "y"):
os.execl(sys.executable, 'python', '"{}"'.format(__file__), *sys.argv[1:])
else:
exit(0)
import os
import sys
if(input("Would you like to restart?\n") == "y"):
os.execl(sys.executable, 'python', '"{}"'.format(__file__), *sys.argv[1:])
else:
exit(0)