I am developing a program that reads user input within different functions. If the user types a magic word (say "restart"), I want to go to a specific location in my main module. I can do that by replacing the main code by a function -- say "my_main_code_function(restart_flag) -- that calls my main code and call it again if the user typed the magic word. While I am new to Python, I suspect that the stack will keep on growing each time the user chooses this option.
Is there a more elegant way to do that?