[Tutor] re-import

Kent Johnson kent37 at tds.net
Mon Oct 30 12:07:33 CET 2006


Glenn T Norton wrote:
> jhl wrote:
> 
>> Hi-
>>
>> How is the 1st import of a module removed so that new edits on the 
>> module can be re-imported?
>>
> Read about reload here:
> http://docs.python.org/lib/built-in-funcs.html

Make sure you understand the limitations of reload(). In particular, 
names that are imported using 'from xxx import *' or 'from xxx import 
yyy' will not be updated if you reload(xxx), and objects created from 
class definitions in xxx will still refer to the old classes. You can 
read a little more about it here:
http://www.python.org/doc/faq/programming/#when-i-edit-an-imported-module-and-reimport-it-the-changes-don-t-show-up-why-does-this-happen

Kent



More information about the Tutor mailing list