Assuming I have two Python modules and path_b is in the import path:
# file: path_b/my_module.py print \"I was imported from ???\" #file: path_a/app.py impo
Try my_module.__file__ to find out where it is from. If you get an AttributeError, it is probably not a Python source (.py) file.
my_module.__file__
AttributeError