Runtime Data Attributes
module.__file__
Optional origin pathname for file-backed modules. Built-in or synthetic modules may lack this field; a value is not proof that the file exists.
Formal Syntax & Structure
python syntaxpython
module.__file__Return Value
str (when present)
Value exposed by this attribute; availability and mutability depend on the owner as described.
Working Example
Example Snippetpython
from types import ModuleTypem = ModuleType('demo')print(hasattr(m,'__file__'))