[Tutor] reloading a module

bob gailer bgailer at gmail.com
Thu Oct 4 04:12:12 CEST 2012


On 10/3/2012 9:56 PM, Leo Degon wrote:
> So Ive got code that i import a module to get certain saved variables, 
> where i edit the text file that comprises the module to edit those 
> saved variable. My problem is I cant reload the module to access those 
> modified variables.
Why not? What did you try?
> I was wondering how can i reload or otherwise refresh the module.
> python3 on linux
>
Answer:

 >>> import x
 >>> # make some changes to x.py
 >>> reload(x)

-- 
Bob Gailer
919-636-4239
Chapel Hill NC



More information about the Tutor mailing list