How to reload a module's function in Python?
问题 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 回答1: What you want is possible, but requires reloading two things... first reload(foo) , but then you also have to reload(baz) (assuming baz is the name of the module containing the from foo import bar statement). As to why... When foo is first loaded, a foo object is created, containing a bar object. When you