Returns the folder where the code of the caller's caller lives

def caller_folder():
    """
    Returns the folder where the code of the caller's caller lives
    """
    import inspect
    caller_file = inspect.stack()[2][1]
    if os.path.exists(caller_file):
        return os.path.abspath(os.path.dirname(caller_file))
    else:
        return os.path.abspath(os.getcwd())