Unimport module

C

Chmouel Boudjnah

Hi,

I have some code like that to do kind of plugins load :

dir = listdir('/path/')
for i in dir:
sys.path.append('/path/' + i "/")
import Module
doStuff()
sys.path.remove('/path/' + i "/")

it's obviously not working since it get only the first import Module
while the others doent get replaced, the only solution for me was too :

sys.modules.pop('Module')

which after it does works fine. But my question is what's happenning in
the internals, does it free the memory of Module to do a sys.modules.pop ?

Cheers, Chmouel.

PS: Please Mail-Copy-To: i am not subscribed to the list
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,222
Messages
2,571,142
Members
47,756
Latest member
JulienneY0

Latest Threads

Top