def load_module(name, original_module):
    """
    Load a copy of a module, distinct from what you'd get if you imported
    it directly.

    @param str name: The name of the new module.
    @param original_module: The original module we're recreating.

    @return: A new, distinct module.
    """
    module = ModuleType(name)
    if PY3:
        import importlib.util
        spec = importlib.util.find_spec(original_module.__name__)
        source = spec.loader.get_code(original_module.__name__)
    else:
        if getattr(sys, "frozen", False):
            raise NotImplementedError("Can't load modules on Python 2 with PyInstaller")
        path = original_module.__file__
        if path.endswith(".pyc") or path.endswith(".pyo"):
            path = path[:-1]
        with open(path) as f:
            source = f.read()
    exec_(source, module.__dict__, module.__dict__)
    return module
Load a copy of a module, distinct from what you'd get if you imported
    it directly.

    @param str name: The name of the new module.
    @param original_module: The original module we're recreating.

    @return: A new, distinct module.