importlib.abc.MetaPathFinder.find_spec()

find_spec(fullname, path, target=None) An abstract method for finding a spec for the specified module. If this is a top-level import, path will be None. Otherwise, this is a search for a subpackage or module and path will be the value of __path__ from the parent package. If a spec cannot be found, None is returned. When passed in, target is a module object that the finder may use to make a more educated about what spec to return. New in version 3.4.

importlib.abc.MetaPathFinder.find_module()

find_module(fullname, path) A legacy method for finding a loader for the specified module. If this is a top-level import, path will be None. Otherwise, this is a search for a subpackage or module and path will be the value of __path__ from the parent package. If a loader cannot be found, None is returned. If find_spec() is defined, backwards-compatible functionality is provided. Changed in version 3.4: Returns None when called instead of raising NotImplementedError. Can use find_spec() to p

importlib.abc.Loader.module_repr()

module_repr(module) A legacy method which when implemented calculates and returns the given module’s repr, as a string. The module type’s default repr() will use the result of this method as appropriate. New in version 3.3. Changed in version 3.4: Made optional instead of an abstractmethod. Deprecated since version 3.4: The import machinery now takes care of this automatically.

importlib.abc.MetaPathFinder.invalidate_caches()

invalidate_caches() An optional method which, when called, should invalidate any internal cache used by the finder. Used by importlib.invalidate_caches() when invalidating the caches of all finders on sys.meta_path. Changed in version 3.4: Returns None when called instead of NotImplemented.

importlib.abc.MetaPathFinder

class importlib.abc.MetaPathFinder An abstract base class representing a meta path finder. For compatibility, this is a subclass of Finder. New in version 3.3. find_spec(fullname, path, target=None) An abstract method for finding a spec for the specified module. If this is a top-level import, path will be None. Otherwise, this is a search for a subpackage or module and path will be the value of __path__ from the parent package. If a spec cannot be found, None is returned. When passed in

importlib.abc.Loader

class importlib.abc.Loader An abstract base class for a loader. See PEP 302 for the exact definition for a loader. create_module(spec) A method that returns the module object to use when importing a module. This method may return None, indicating that default module creation semantics should take place. New in version 3.4. Changed in version 3.5: Starting in Python 3.6, this method will not be optional when exec_module() is defined. exec_module(module) An abstract method that ex

importlib.abc.Loader.create_module()

create_module(spec) A method that returns the module object to use when importing a module. This method may return None, indicating that default module creation semantics should take place. New in version 3.4. Changed in version 3.5: Starting in Python 3.6, this method will not be optional when exec_module() is defined.

importlib.abc.Loader.load_module()

load_module(fullname) A legacy method for loading a module. If the module cannot be loaded, ImportError is raised, otherwise the loaded module is returned. If the requested module already exists in sys.modules, that module should be used and reloaded. Otherwise the loader should create a new module and insert it into sys.modules before any loading begins, to prevent recursion from the import. If the loader inserted a module and the load fails, it must be removed by the loader from sys.module

importlib.abc.Loader.exec_module()

exec_module(module) An abstract method that executes the module in its own namespace when a module is imported or reloaded. The module should already be initialized when exec_module() is called. New in version 3.4.

importlib.abc.InspectLoader.load_module()

load_module(fullname) Implementation of Loader.load_module(). Deprecated since version 3.4: use exec_module() instead.