3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-12-25 04:02:45 +01:00

corecommands: actually assign reload() output to update the module

This commit is contained in:
James Lu 2016-07-11 16:53:32 -07:00
parent 6904ba9606
commit cf40a38c14

View File

@ -72,7 +72,7 @@ def load(irc, source, args):
return return
log.info('(%s) Loading plugin %r for %s', irc.name, name, irc.getHostmask(source)) log.info('(%s) Loading plugin %r for %s', irc.name, name, irc.getHostmask(source))
try: try:
world.plugins[name] = pl = utils.loadPlugin(name) world.plugins[name] = pl = importlib.reload(utils.loadPlugin(name))
except ImportError as e: except ImportError as e:
if str(e) == ('No module named %r' % name): if str(e) == ('No module named %r' % name):
log.exception('Failed to load plugin %r: The plugin could not be found.', name) log.exception('Failed to load plugin %r: The plugin could not be found.', name)
@ -80,7 +80,6 @@ def load(irc, source, args):
log.exception('Failed to load plugin %r: ImportError.', name) log.exception('Failed to load plugin %r: ImportError.', name)
raise raise
else: else:
importlib.reload(pl)
if hasattr(pl, 'main'): if hasattr(pl, 'main'):
log.debug('Calling main() function of plugin %r', pl) log.debug('Calling main() function of plugin %r', pl)
pl.main(irc) pl.main(irc)