There are a few question (and answers) about unimporting a module. All of them quite old, and one even indicate on about 2010 a Python reply not possible for the next 5 years
. Well now we are a few version and years away from that statement.
Perhaps, still not possible, but any work around?
I have a web application that run arbitrary external code, importing, testing and calling the script by functions name.
__import__(ExternalCodeScriptName.replace('.py',''))
Assume we import a few hundred, how can I 'unimport
' the unused? Perhaps I can take a current state picture and the restore the main app to that state? To restart the application is not a valid option.