reloading the module imported as 'from ... import ...'
William
abecedarian314159 at yahoo.com
Mon Aug 10 13:19:31 EDT 2009
What about using the reimport library?
http://code.google.com/p/reimport/
Cheers,
William
________________________________
From: AlF <spamgrinder.trylater at ggmail.com>
To: python-list at 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090810/d37ce184/attachment-0001.html>
More information about the Python-list
mailing list