def get_ability_instance_by_name(self, name, module_factory):
# First, we reload the ability, just in case it changed on disk
for abl in self._mod.exported_abilities:
if abl.get_name() == name:
reload(inspect.getmodule(abl))
# We need to reload the "module" because the submodule were reloaded too
self._mod = module_factory.reload_module(self._mod_path)
for abl in self._mod.exported_abilities:
if abl.get_name() == name:
opts = {k: v for k, v in self._defaults.items() if k in abl.get_option_list()}
return abl(
module_factory,
default_opts=opts,
view=self._view
)
return None
评论列表
文章目录