sys.modules['path.to.module'].__file__
Python 2.7.2+ (default, Oct 4 2011, 20:06:09) [GCC 4.6.1] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import collections >>> import sys >>> sys.modules['collections'].__file__ '/usr/lib/python2.7/collections.pyc' >>>
source share