Registers a callable to be executed when a module is imported. If the
module already exists then the callable will be executed immediately. You
can register the same module multiple times, the callables will be
executed in the order they were registered. The root module must exist
(i.e. be importable) otherwise an ImportError will be
thrown.
- Parameters:
mod (str ) - The fully qualified module string, as used in the imports
statement. E.g. 'foo.bar.baz'. The string must map to a module
otherwise the callable will not fire.
func (callable) - The function to call when mod is imported. This
function must take one arg, the newly imported
module object.
- Raises:
TypeError - func must be callable
|