Q:

Python - How can I essentially "Restart" my program?

I have been stuck on this for days. I love Stack Overflow, and I have used it as a HUGE helping tool. I know you want to keep this question answerable and helpful to a large group of potential visitors, so I hope this is good.
I have a QuizEditor program. I made a quiz game that works flawlessly as a CLI, so did my editor. However, porting it to GUI is oddly a lot harder than I originally anticipated. You can find the qt001.py (quizTest001.py) and the question list, qtquest.dat here, they're quite large:
Quiz Editor GUI  ,
Question List
My question is this: How can I "RESTART" the application? If you download the files and try it out yourself, you press "EDIT" change some stuff, and press "SAVE". It comes up saying you need to restart the app to view the changes. How can I make it so you don't even need to manually restart the app, it does it itself. This is a common problem on StackOverflow I've noticed and I've tried many of the fixes:
1
2
3
4
And so many more. I'm frustrated. I've destroyed the topLevel window, I've destroyed and restarted root, imported the app and reloaded(qt001), tried rerunning init, and so much more. I feel like the process is simple and I'm missing something.
Any help is greatly, GREATLY, appreciated.
Thank you much,
Joe.
EDIT: The print statements in the file are meant for debugging; when I run updateDisplay() it prints the quizList array, and I see the changes have been made. However, the visuals haven't changed - the entry boxes, the radio buttons, those are the same unless the app is closed and reopened.

A:

To Restart the program, what you need to do is import os & sys & then in your saveQuestion method write:
python = sys.executable
os.execl(python, python, * sys.argv)

Note: Any cleanup action (like saving data) must be done before calling this function.
Credit goes to Gribouillis

