def inject_path(path):
    """
    Imports :func: from a python file at :path: and executes it with *args, **kwargs arguments. Everytime this function
    is called the module is reloaded so that you can alter your debug code while the application is running.

    The result of the function is returned, otherwise the exception is returned (if one is raised)
    """
    try:
        dirname = os.path.dirname(path)
        if dirname not in sys.path:
            exists_in_sys = False
            sys.path.append(dirname)
        else:
            exists_in_sys = True
        module_name = os.path.splitext(os.path.split(path)[1])[0]
        if module_name in sys.modules:
            reload(sys.modules[module_name])
        else:
            __import__(module_name)
        if not exists_in_sys:
            sys.path.remove(dirname)
    except Exception as e:
        return e