Reload plugins if already loaded

This commit is contained in:
Philipp Hörist 2017-02-23 17:57:11 +01:00
parent 8e8605615f
commit 5c11e240b1
1 changed files with 7 additions and 4 deletions

View File

@ -493,11 +493,14 @@ class PluginManager(metaclass=Singleton):
module = None
if module_name in sys.modules:
# do not load the module twice
continue
try:
module = __import__(module_name)
if module_name in sys.modules:
from imp import reload
log.info('Reloading %s', module_name)
module = reload(sys.modules[module_name])
else:
log.info('Loading %s', module_name)
module = __import__(module_name)
except Exception as error:
log.warning(
"While trying to load {plugin}, exception occurred".format(plugin=elem_name),