I've been told that creating a PythonInterpreter object is relatively expensive, and therefore it makes sense to cache/reuse it somehow. However, I'm having difficulties to "reset" the interpreter to its initial state. By resetting I mean clearing all previous variables, functions and class definitions. I thought interp.cleanup() would do something like that, but it doesn't seem to have any effect.

Is there a way to "reset" the interpreter, or should I just recreate it?

Best Regards,