A module to change reload() so that it acts recursively. To enable it type:
import __builtin__, deepreload
__builtin__.reload = deepreload.reload
You can then disable it with:
__builtin__.reload = deepreload.original_reload
Alternatively, you can add a dreload builtin alongside normal reload with:
__builtin__.dreload = deepreload.reload
This code is almost entirely based on knee.py, which is a Python re-implementation of hierarchical module import.
mod.{subname} = submod
Replacement for __import__()
Replacement for reload().
Handle ‘from module import a, b, c’ imports.
Return the package that an import is being performed in. If globals comes from the module foo.bar.bat (not itself a package), this returns the sys.modules entry for foo.bar. If globals is from a package’s __init__.py, the package’s entry in sys.modules is returned.
If globals doesn’t come from a package or a module in a package, or a corresponding entry is not found in sys.modules, None is returned.
altmod is either None or same as mod
Recursively reload all modules used in the given module. Optionally takes a list of modules to exclude from reloading. The default exclude list contains sys, __main__, and __builtin__, to prevent, e.g., resetting display, exception, and io hooks.