from inspect import getmodule
print(getmodule(os))
import imp
print("Location of Python os module sources:")
print(imp.find_module('os'))
print("
Location of Python time module sources:")
print(imp.find_module('time'))
import inspect
inspect.getfile(<mdule name>)
this video might help: https://youtu.be/PzlQPNNt8T4?t=147
(video starts at 2:27)
import a_module
print(a_module.__file__)