Skip to content

Commit

Permalink
check module is loaded before deleting it (#563)
Browse files Browse the repository at this point in the history
* check module is loaded before deleting it

* fix key error
  • Loading branch information
willydouhard authored Nov 26, 2023
1 parent a12a707 commit c362cde
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion backend/chainlit/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ def load_module(target: str, force_refresh: bool = False):
and module.__file__
and module.__file__.startswith(target_dir)
):
del sys.modules[module_name]
sys.modules.pop(module_name, None)

spec = util.spec_from_file_location(target, target)
if not spec or not spec.loader:
Expand Down

0 comments on commit c362cde

Please sign in to comment.