Rasa_core_sdk using multiple files including actions located in a different path then the current work_dir


(Moritz Schweppenhäuser) #1

Hey, I was just in the process of updating to rasa_core 0.11.2 and ran into a probelm using rasa_core_sdk.
So my setup looks something like this:

project_dir/
    -chatbot/
        -actions/
            -action_file_01.py
            -action_file_02.py
            -action_file_03.py

I was now trying to run the sdk server using:

python -m rasa_core_sdk.endpoint --actions chatbot/actions/action_file_01

and it looks like rasa can’t find the file:

ModuleNotFoundError: No module named 'chatbot/actions/action_file_01'

Am I doing something wrong and also is there a way to pass all three action_files to the server?


PS: I found a workaround, I don’t think is ideal. I created an actions.py-file inside the project_dir where I just import all my action_files. I then start the sdk-server using:

python -m rasa_core_sdk.endpoint --actions actions

which appears to be working


(Akela Drissner) #2

@tmbo can you load in a folder too?


(Tom Bocklisch) #3

The --actions is not file based but module based.

You don’t necessarily need to create a module that imports all the actions, but you need to make sure that the actions are all part of one module, e.g.

project_dir/
    -chatbot/
        -__init__.py
        -actions/
            -__init__.py
            -action_file_01.py
            -action_file_02.py
            -action_file_03.py

mind the additional __init__.py's to make the folders proper modules. After that you can specify any module and the sdk will recursivly try to find all the actions:

python -m rasa_core_sdk.endpoint --actions chatbot.actions


(Moritz Schweppenhäuser) #4

Thanks for clearing that up! :slight_smile: