ID EN
Inspect

getfile

Python 3.11

Return the name of the (text or binary) file in which an object was defined. This will fail with a TypeError if the object is a built-in module, class, or function.

Syntax

PYTHON
inspect.getfile(object)

See Also

TypeError