def load_module(self, module_name, pfx=None, path=None):
        """Load/reload module from the given name."""
        try:
            if pfx:
                name = pfx + '.' + module_name
            else:
                name = module_name

            if name in sys.modules:
                module = sys.modules[name]
                self.logger.info("Reloading module '%s'..." % module_name)
                module = importlib.reload(module)

            else:
                self.logger.info("Loading module '%s'..." % module_name)
                module = my_import(name, path=path)

            self.module[module_name] = module
            return module

        except Exception as e:
            self.logger.error("Failed to load module '%s': %s" % (
                module_name, str(e)))
            raise ModuleManagerError(e)
def load_module ( self , module_name , pfx = None , path = None ) : try : if pfx : name = pfx + '.' + module_name else : name = module_name if name in sys . modules : module = sys . modules [ name ] self . logger . info ( "Reloading module '%s'..." % module_name ) module = importlib . reload ( module ) else : self . logger . info ( "Loading module '%s'..." % module_name ) module = my_import ( name , path = path ) self . module [ module_name ] = module return module except Exception as e : self . logger . error ( "Failed to load module '%s': %s" % ( module_name , str ( e ) ) ) raise ModuleManagerError ( e )
Load/reload module from the given name.