importlib - A pure Python implementation of import.
| Use Case | Command | Description |
|---|---|---|
| Import a module by name | importlib.import_module('module_name') | Import a module, supporting relative imports with the package argument. |
| Reload a module | importlib.reload(module) | Reload a previously imported module (useful during development). |
| Invalidate import caches | importlib.invalidate_caches() | Clear internal caches of all meta path finders (e.g., after installing new modules). |
https://docs.python.org/3.10/library/importlib.html
The following documentation is automatically generated from the Python source files. It may be incomplete, incorrect or include features that are considered implementation detail and may vary between Python implementations. When in doubt, consult the module reference at the location listed above.
__import__(name, globals=None, locals=None, fromlist=(), level=0) — Import a module. The 'globals' argument is used to infer where the import is occurring from to handle relative imports. The 'locals' argument is ignored. The 'fromlist' argument specifies what should exist as attributes on the module being imported (e.g. from module import <fromlist>). The 'level' argument represents the package location to import from in a relative import (e.g. from ..pkg import mod would have a 'level' of 2).import_module(name, package=None) — Import a module. The 'package' argument is required when performing a relative import. It specifies the package to use as the anchor point from which to resolve the relative import to an absolute import.invalidate_caches() — Call the invalidate_caches() method on all meta path finders stored in sys.meta_path (where implemented).reload(module) — Reload the module and return it. The module must have been successfully imported before.__all__ = ['__import__', 'import_module', 'invalidate_caches', 'reload...
/usr/lib/python3.10/importlib/__init__.py
Generated by phpman v4.10.0-7-g98e9fd5 · Markdown · JSON · MCP Author: Che Dong Under GNU General Public License
2026-09-01 16:48 @216.73.216.239
CrawledBy Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +claudebot@anthropic.com)