How do I get the filepath for a class in Python? December 18, 2022 by Tarik You can use the inspect module, like this: import inspect inspect.getfile(C.__class__)