Re: How to unload a module after I've imported it.
- From: Fuzzyman <fuzzyman@xxxxxxxxx>
- Date: Sun, 30 Sep 2007 15:17:48 -0000
On Sep 29, 9:32 pm, marvinla <marvinware2...@xxxxxxxxx> wrote:
Have you tried a del?
import socket
dir()
['__builtins__', '__doc__', '__name__', 'socket']>> del socket
dir()
['__builtins__', '__doc__', '__name__']
See you!
Trueimport socket
import sys
'socket' in sys.modules
Falsedel sys.modules['socket']
'socket' in sys.modules
Although as Gabriel says, this may not be the best approach for this
particular need.
A new import will do a full reload of the socket module.
Michael
http://www.manning.com/foord
.
- References:
- How to unload a module after I've imported it.
- From: Johny
- Re: How to unload a module after I've imported it.
- From: marvinla
- How to unload a module after I've imported it.
- Prev by Date: Re: Command-line does work when scheduled
- Next by Date: Create a string array of all comments in a html file...
- Previous by thread: Re: How to unload a module after I've imported it.
- Next by thread: Command-line does work when scheduled
- Index(es):
Relevant Pages
|