def module_path(local_function):
 return os.path.abspath(inspect.getsourcefile(local_function))

def module_path ( local_function ) : return os . path . abspath ( inspect . getsourcefile ( local_function ) )
returns the module path without the use of __file__ .