def caller_path(steps=1):
    """Return the path to the source file of the current frames' caller."""
    frame = sys._getframe(steps + 1)

    try:
        path = os.path.dirname(frame.f_code.co_filename)
    finally:
        del frame

    if not path:
        path = os.getcwd()

    return os.path.realpath(path)
def caller_path ( steps = 1 ) : frame = sys . _getframe ( steps + 1 ) try : path = os . path . dirname ( frame . f_code . co_filename ) finally : del frame if not path : path = os . getcwd ( ) return os . path . realpath ( path )
Return the path to the source file of the current frames' caller.