Unload a module in Python

Python does not support unloading modules.

However, unless your program loads an unlimited number of modules over time, that’s not the source of your memory leak. Modules are normally loaded once at start up and that’s it. Your memory leak most likely lies elsewhere.

In the unlikely case that your program really does load an unlimited number of modules over time, you should probably redesign your program. 😉

Leave a Comment