Pythonモジュールのパスの取得


import a_module
print a_module.__file__

プラットフォームにまたがる必要がある場合は、次のコードを使用します.
import os
path = os.path.dirname(amodule.__file__)