Is it possible to remove a class definition from a running instance of Python?
I have a Python interpreter built into my C++ that I'd like to add and remove classes depending on the current state of the application. For example, if I have a Menu hierarchy that has a corresponding class defined for that menu, I'd like to remove that class if the menu is not visible.
One possible solution is to put the class in a module and unload that module (How do I unload (reload) a Python module?), but I'm wondering if there's an easier way.