def get_module(self, name, folder=None): """Returns a `PyObject` if the module was found.""" module = self.find_module(name, folder) if module is None: module = self._builtin_module(name) if module is None: raise ModuleNotFoundError('Module %s not found' % name) return module return self.resource_to_pyobject(module)
def get_module(self, name, folder=None): """Returns a `PyObject` if the module was found.""" # check if this is a builtin module pymod = self.pycore.builtin_module(name) if pymod is not None: return pymod module = self.find_module(name, folder) if module is None: raise ModuleNotFoundError('Module %s not found' % name) return self.pycore.resource_to_pyobject(module)
def get_relative_module(self, name, folder, level): module = self.find_relative_module(name, folder, level) if module is None: raise ModuleNotFoundError('Module %s not found' % name) return self.resource_to_pyobject(module)