Runtime Data Attributes

module.__name__

Module name, normally its fully qualified import name, or __main__ for a directly executed module. Prefer consistent import metadata rather than manually renaming.

Formal Syntax & Structure

python syntaxpython
module.__name__

Return Value

str

Value exposed by this attribute; availability and mutability depend on the owner as described.

Working Example

Example Snippetpython
from types import ModuleTypem = ModuleType('demo.tools')print(m.__name__)
Python Reference