Skip to content

Commit

Permalink
Prevent reload on modules that failed to initialize
Browse files Browse the repository at this point in the history
See comment in sopel-irc#1399
  • Loading branch information
HumorBaby committed Nov 5, 2018
1 parent 772d552 commit 4e77958
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion sopel/modules/reload.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ def f_reload(bot, trigger):
bot.setup()
return bot.reply('done')

if name not in sys.modules and name not in sopel.loader.enumerate_modules(
# Use OR instead of AND because modules that fail to load will not have been
# added to sys.modules; `reload_module_tree` should not even be reached if
# reload is attempted on a module that failed to load in the first place.
if name not in sys.modules or name not in sopel.loader.enumerate_modules(
bot.config):
return bot.reply('"%s" not loaded, try the `load` command' % name)

Expand Down

0 comments on commit 4e77958

Please sign in to comment.