Runtime Data Attributes

module.__path__

Package submodule search locations. Ordinary non-package modules should not have this attribute; prefer __spec__.submodule_search_locations for inspection.

Formal Syntax & Structure

python syntaxpython
module.__path__

Return Value

sequence[str] (packages only)

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_specm = module_from_spec(ModuleSpec('demo',None,is_package=True))print(list(m.__path__))
Python Reference