Skip to content

Commit

Permalink
Fix wrong import logic when loading modules
Browse files Browse the repository at this point in the history
Only load module within package, not all accessible modules

Loading all accessible modules causes a bug when an accessible module has a same name with module inside package
  • Loading branch information
sonbn0 committed Jan 22, 2020
1 parent 0114b60 commit 13b1d69
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rasa_sdk/executor.py
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,9 @@ def _import_submodules(
return

results = {}
for loader, name, is_pkg in pkgutil.walk_packages(package.__path__):
for loader, name, is_pkg in pkgutil.walk_packages(
package.__path__, package.__name__
):
full_name = package.__name__ + "." + name
results[full_name] = importlib.import_module(full_name)
if recursive and is_pkg:
Expand Down

0 comments on commit 13b1d69

Please sign in to comment.