Monday, December 17, 2018

Where is the source file of an imported module?

from PackageABC.ParentModule import ChildModule

import inspect
print(inspect.getsourcefile(ChildModule))

#which would be in one of these paths
import sys
for p in sys.path:
    print(p)

No comments:

Post a Comment