ending a imported module

Maybe my game concept is flawed but what I would like to do is have a menu of directbuttons that call each level of the game.

OKAy I wrote this and it works-

BUT how to I exit out of a loaded module once it is complete and return to the main menu?

Is there a way to just kill or unload the module similar to exiting the whole program such as sys.exit but just for the module.

Or will I have to write a level loader and unloader?


You will have to write a level loader and unloader. It just means that whatever your level does when it loads, it will have to be prepared to undo.


I see. I am thinking a external gui that called a panda window then killed it might be simpler.


Could one create a object that contained all the code then delete that object?