Home › Forums › Python Programming › How to reload a python module in same program ? › Reply To: How to reload a python module in same program ?
August 1, 2013 at 7:56 pm
#1961
Keymaster
The builtin python function called ‘reload’ can be used to reload a module inside the same program.
>>>> reload.__doc__ 'reload(module) -> module\n\nReload the module. The module must have been successfully imported before.' >>> For ex:
>>>> import os >>> os <module 'os' from '/usr/lib64/python2.7/os.pyc'> >>> reload(os) <module 'os' from '/usr/lib64/python2.7/os.pyc'> >>> os