code: def load_module_from_modpath(parts, path=None, use_sys=1):
      
      if use_sys:
          try:
              return sys.modules[".".join(parts)]
          except KeyError:
              pass
      modpath = []
      prevmodule = None
      for part in parts:
          modpath.append(part)
          curname = ".".join(modpath)
          module = None
          if len(modpath) != len(parts):
              # even with use_sys=False, should try to get outer packages from sys.modules
              module = sys.modules.get(curname)
          elif use_sys:
              # because it may have been indirectly loaded through a parent
              module = sys.modules.get(curname)
          if module is None:
              mp_file, mp_filename, mp_desc = imp.find_module(part, path)
              module = imp.load_module(curname, mp_file, mp_filename, mp_desc)
              # mp_file still needs to be closed.
              if mp_file:
                  mp_file.close()
          if prevmodule:
              setattr(prevmodule, part, module)
          _file = getattr(module, "__file__", "")
          prevmodule = module
          if not _file and util.is_namespace(curname):
              continue
          if not _file and len(modpath) != len(parts):
              raise ImportError("no module in %s" % ".".join(parts[len(modpath) :]))
          path = [os.path.dirname(_file)]
      return module
docs: Load a python module from its split name.
  
      :type parts: list(str) or tuple(str)
      :param parts:
        python name of a module or package split on '.'
  
      :type path: list or None
      :param path:
        optional list of path where the module or package should be
        searched (use sys.path if nothing or None is given)
  
      :type use_sys: bool
      :param use_sys:
        boolean indicating whether the sys.modules dictionary should be used or not
  
      :raise ImportError: if the module or package is not found
  
      :rtype: module
      :return: the loaded module