ID EN
Inspect

getsourcefile

Python 3.11

Return the name of the Python source file in which an object was defined or None if no way can be identified to get the source. This will fail with a TypeError if the object is a built-in module, class, or function.

Syntax

PYTHON
inspect.getsourcefile(object)

See Also

TypeError