How to manage a lot of actions in

I have a lot of actions defined in file. As a result, my file is now very large (in terms of code). Is there any way to partition this file ( into different number of files, each related to a specific category action?

Hi @Sajjadmanal, yes you can partition your actions in multiple files! Just create a directory actions and place your code in it, splitting it as you see fit.
As far as I’m aware, as long as it’s in actions, Rasa will pick up and register the relevant classes based on the rasa_sdk classes like FormValidationAction, Action, etc, and not based on which module they’re in.

When starting the server, rasa run actions should work just as well.
Hope that helps!

1 Like

@E-dC Thanks for the reply. Okay, so each of the file will import everything that gets imported in And for dockerfile, do we need to add these new files?

For running locally everything in the actions folder will be imported. If you have a dockerfile for actions just add “RUN mkdir -p actions” and “COPY . ./actions/”.


Not quite: say you have an actions directory as follows:


You can organise your actions as a regular python package: perhaps some modules import other, etc
As far as I’m aware, the server will load all your code this way, but will register actions by looking at your classes definitions (ActionAbc(Action)will get registered, but SomeOtherClass(object) won’t).

For Dockerfile, yes, as @simonm3 wrote, you need to copy the whole actions folder


Thanks @E-dC

Thanks @simonm3