Following up on this question regarding reloading a module, how do I reload a specific function from a changed module?
pseudo-code:
from foo import bar if foo.py has changed: reload bar
As of today, the proper way of doing this is:
import sys, importlib importlib.reload(sys.modules['foo']) from foo import bar
Tested on python 2.7, 3.5, 3.6.
1.4m articles
1.4m replys
5 comments
57.0k users