Runtime Data Attributes
module.__spec__
Import-system specification describing name, loader, origin and package search information. A bare ModuleType may have None; module_from_spec initializes metadata.
Formal Syntax & Structure
python syntaxpython
module.__spec__Return Value
importlib.machinery.ModuleSpec | None
Value exposed by this attribute; availability and mutability depend on the owner as described.
Working Example
Example Snippetpython
from importlib.machinery import ModuleSpecfrom importlib.util import module_from_specspec = ModuleSpec('demo',loader=None,is_package=True)m = module_from_spec(spec)print(m.__spec__ is spec)