re-run python

Hello I am trying to restart my program from scratch with os.execl() function anyone know how I might be able to do it. when I run this line of code [ os.execl(sys.executable, sys.executable, *sys.argv) ] however it only restarts the program but does not run it.

Unfortunately it’s very difficult to help this with limited context.

I guess you restart your program, but you are closing it with the main process. You need to make it independent by creating a fork!

1 Like