wention
7/16/2019 - 3:11 AM

import module by path

def import_file(full_path_to_module):
    try:
        import os
        import imp

        module_dir, module_file = os.path.split(full_path_to_module)
        module_name, module_ext = os.path.splitext(module_file)

        fp, pathname, description = imp.find_module(module_name, [module_dir])

        return imp.load_module(module_name, fp, module_dir, description)
    except:
        raise ImportError