reloading the module imported as 'from ... import ...'

AlF spamgrinder.trylater at ggmail.com
Sun Aug 9 23:43:41 EDT 2009


Hi,

what is the best way to reload the module imported using 'from ... 
import ...'

Is following a way to do so?


 >>> from email.charset import Charset
 >>> reload(email.charset)
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
NameError: name 'email' is not defined
 >>>
 >>>
 >>> import email.charset
 >>> reload(email.charset)
<module 'email.charset' from '/usr/lib/python2.5/email/chars


Probably it works but I do not like it as I end up with two namespaces 
for the symbol Charset: email.charset.Charset and Charset

Thx,
A.



More information about the Python-list mailing list