def mod_from_file(mod_name, path):
    """Runs the Python code at path, returns a new module with the resulting globals"""
    attrs = runpy.run_path(path, run_name=mod_name)
    mod = imp.new_module(mod_name)
    mod.__dict__.update(attrs)
    return mod
Runs the Python code at path, returns a new module with the resulting globals
recipes/Python/577792_Create_module_directly_filesystem/recipe-577792.py