Forgetting an import
Miki
miki.tebeka at gmail.com
Tue Jun 12 13:30:13 EDT 2007
Hello,
> I imported a set of functions from a file I wrote to interpreter
> shell:
>
> from myFile import *
>
> Now if I change functions in this file how can I make python forget it
> so I can force a fresh import?
"import *" is evil for many reasons, this is one of them :)
>>> import my_module
>>> my_module.add(1, 1)
4
[Hack]
>>> reload(my_module)
<module 'my_module' from '/tmp/my_module.py'>
>>> my_module.add(1, 1)
2
HTH,
--
Miki <miki.tebeka at gmail.com>
http://pythonwise.blogspot.com
More information about the Python-list
mailing list