def loadmodules(self, modules=None, rel=None):
result = []<EOL>if rel is None:<EOL><INDENT>rel = self.rel<EOL><DEDENT>if modules is None:<EOL><INDENT>modules = self._modules<EOL><DEDENT>for module in modules:<EOL><INDENT>if isinstance(module, string_types):<EOL><INDENT>name = module<EOL>module = lookup(name)<EOL><DEDENT>elif isinstance(module, ModuleType):<EOL><INDENT>name = module.__name__<EOL><DEDENT>else:<EOL><INDENT>raise TypeError(<EOL>'<STR_LIT>'<EOL>.format(<EOL>module, modules<EOL>)<EOL>)<EOL><DEDENT>if not rel and module in self._loadedmodules:<EOL><INDENT>continue<EOL><DEDENT>reload_module(module)<EOL>result.append(module)<EOL>self._loadedmodules.add(module)<EOL><DEDENT>return result<EOL>
ry to (re)load modules and return loaded modules.

        :param modules: list of module (name) to load.
        :param bool rel: flag for forcing reload of module. Default is this
            rel flag (false by default).
        :rtype: list
        :return: loaded modules.