[Tutor] reloading a module
Steven D'Aprano
steve at pearwood.info
Thu Oct 4 04:07:04 CEST 2012
On 04/10/12 11:56, 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.
> I was wondering how can i reload or otherwise refresh the module.
> python3 on linux
The reload function is removed from the built-ins from Python 3 because it
is a bit of a trap for the careless and the beginner. But it isn't removed
completely. Run this when you start up Python:
from imp import reload
Now you can call reload(module) as in Python 2.
--
Steven
More information about the Tutor
mailing list