Use importlib machinery to import a module `modname` from the file `modfile`. Depending on the `spec.loader`, the module may not be registered in sys.modules.
(modname, modfile)
| 2482 | |
| 2483 | |
| 2484 | def exec_mod_from_location(modname, modfile): |
| 2485 | ''' |
| 2486 | Use importlib machinery to import a module `modname` from the file |
| 2487 | `modfile`. Depending on the `spec.loader`, the module may not be |
| 2488 | registered in sys.modules. |
| 2489 | ''' |
| 2490 | spec = importlib.util.spec_from_file_location(modname, modfile) |
| 2491 | foo = importlib.util.module_from_spec(spec) |
| 2492 | spec.loader.exec_module(foo) |
| 2493 | return foo |
no outgoing calls
no test coverage detected