Helper function that tries to load a filepath (or python module notation)
    as a python module and on failure `exec` it.

    Args:
        path (str): Path or module to load

    The function tries to import `example.module` when either `example.module`,
    `example/module` or `example/module.py` is given.

def load(path):
    """Helper function that tries to load a filepath (or python module notation)
    as a python module and on failure `exec` it.

    Args:
        path (str): Path or module to load

    The function tries to import `example.module` when either `example.module`,
    `example/module` or `example/module.py` is given.
    """

    importpath = path.replace("/", ".").replace("\\", ".")
    if importpath[-3:] == ".py":
        importpath = importpath[:-3]

    try:
        importlib.import_module(importpath)
    except (ModuleNotFoundError, TypeError):
        exec(open(path).read())