Closed dabrahams closed 13 years ago
The problems run deep and wide on this one. I'm trying to fix it now. This module sorely needs tests!
Actually I'm beginning to think that this approach is hopelessly unworkable in general, even after you fix it to deal properly with the arguments to the builtin __import__
. The problem is that there are circular imports. Really, you need to release the entire subgraph rooted at the thing being reloaded. Lots more detail on this in: http://stackoverflow.com/questions/437589/how-do-i-unload-reload-a-python-module
So, I'm just sayin', don't count on me for a fix. Sorry!
The first 44 lines of this module seem to actually be working for me. I don't know whether it's general enough to be considered a solution to the problem you're trying to address.
this tree contains a tiny prototype project that demonstrates. Check it out, and type
python master.cfg
in that directory. The output I'm getting is as follows:Note that the
submodule
module gets reloaded, butsubmodule.main
does not.