def path_for_import ( name ) : return os . path . dirname ( os . path . abspath ( import_module ( name ) . __file__ ) )
how to determine the path of a directory in python
Returns the directory path for the given package or module .
def path_for_import(name):
    """
    Returns the directory path for the given package or module.
    """
    return os.path.dirname(os.path.abspath(import_module(name).__file__))