def load_modules(base_name, base_path):
 modules = []
 for (importer, module_name, _) in pkgutil.iter_modules(base_path):
  full_module_name = '{}.{}'.format(base_name, module_name)
  if (full_module_name not in sys.modules):
   module = importer.find_module(module_name).load_module(full_module_name)
  else:
   module = sys.modules[full_module_name]
  modules.append(module)
 return modules

def load_modules ( base_name , base_path ) : modules = [ ] for ( importer , module_name , _ ) in pkgutil . iter_modules ( base_path ) : full_module_name = '{}.{}' . format ( base_name , module_name ) if ( full_module_name not in sys . modules ) : module = importer . find_module ( module_name ) . load_module ( full_module_name ) else : module = sys . modules [ full_module_name ] modules . append ( module ) return modules
load all modules .