What about using the reimport library?

http://code.google.com/p/reimport/

Cheers,
William



________________________________
From: AlF <spamgrinder.tryla...@ggmail.com>
To: python-list@python.org
Sent: Monday, August 10, 2009 1:48:31 AM
Subject: Re: reloading the module imported as 'from ... import ...'

Steven D'Aprano wrote:
> On Sun, 09 Aug 2009 20:43:41 -0700, AlF wrote:
> 
>> Hi,
>> 
>> what is the best way to reload the module imported using 'from ...
>> import ...'
> 
> 
> Have you tried "from ... import ..." again?
> 

I have not because of an assumption that "import" imports the module just once. 
In fact this still works that way:

here is a terminal 1:

$ cat > a.py
a=1
$ cat > a.py
a=2
$


and terminal 2:

>>> from a import a
>>> a
1
>>> a
1
>>> from a import a
>>> a
1
>>>

In spite of changing a.py in fly, the imported a is still 1


-- http://mail.python.org/mailman/listinfo/python-list



      
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to