Try this:; >>> import filegen >>> import inspect >>> print inspect.getsourcefile(filegen.SomeClass) 'C:\\Python23\\Lib\\site-packages\\filegen\filegen.py' Cheers, --Kartic