importlib — The implementation of import — Python 3.9.25 documentation

docs.python.org

Tin mới

runpy — Locating and executing Python modules

Using importlib.metadata

Python documentation for the current stable release

Python documentation for the current stable release

The purpose of the importlib package is two-fold. One is to provide the implementation of the import statement (and thus, by extension, the __import__() function) in Python source code. This provides an implementation of

Python Module Index

3.9.25 Documentation

The Python Standard Library

The import statement

Original specification of packages. Some semantics have changed since the writing of this document (e.g. redirecting based on None in sys.modules).

sys: Access system-specific parameters and functions.

Reload a previously imported module. The argument must be a module object, so it must have been successfully imported before. This is useful if you have edited the module source file using an external editor and want to

__main__: The environment where the top-level script is run.

Reload a previously imported module. The argument must be a module object, so it must have been successfully imported before. This is useful if you have edited the module source file using an external editor and want to

builtins: The module that provides the built-in namespace.

Reload a previously imported module. The argument must be a module object, so it must have been successfully imported before. This is useful if you have edited the module source file using an external editor and want to

ModuleNotFoundError

Changed in version 3.7: ModuleNotFoundError is raised when the module being reloaded lacks a ModuleSpec.

abstract base class

An abstract base class to provide the ability to read resources.

inspect.getmodulename()

Returns a combined list of strings representing all file suffixes for modules recognized by the standard import machinery. This is a helper for code which simply needs to know if a filesystem path potentially refers to a

site: Module responsible for site-specific configuration.

Deprecated since version 3.6: Use site configuration instead. Future versions of Python may not enable this finder by default.