Python still remembers script after change and save

Michael Hudson mwh at python.net
Tue Oct 30 11:43:59 CET 2001


Cliff Wells <logiplexsoftware at earthlink.net> writes:

> On Monday 29 October 2001 11:06, Paul Brian wrote:
> 
> > I occasionally come across a situation where I have changed a file, rerun
> > the file in python but python still produces an error, quoting the original
> > file in the error string
> 
> Are you talking about the main script or a module you are importing?  If you 
> modify a module and import it again, you will still have the original module. 
> You must call reload(module) to force Python to reinterpret the module

And if you're doing "from module import foo" you need to type

>>> import module
>>> reload(module)
>>> from module import foo

Cheers,
M.

-- 
  And then the character-only displays went away (leading to
  increasingly silly graphical effects and finally to ads on
  web pages).                      -- John W. Baxter, comp.lang.python



More information about the Python-list mailing list