4 def import_module(name, path):
5 if sys.version_info >= (3, 5):
7 spec = importlib.util.spec_from_file_location(name, path)
8 module = importlib.util.module_from_spec(spec)
9 spec.loader.exec_module(module)
11 elif sys.version_info >= (3, 0):
12 from importlib.machinery
import SourceFileLoader
13 return SourceFileLoader(name, path).load_module()
16 return imp.load_source(name, path)