EDIT: I just published an article on how to do this
Couple of basic instructions first so it all makes sense.
The first thing to do is create an
actions folder off of your project root
Then create a file in that
actions folder with the name
__init.py__ (that’s 2 underscores before and after) This tells the system this directory is a “package” and everything in here gets loaded.
Then move your
actions.py file into your new
Now you can split up your
actions.py file up.
To do this
- Create a new file - say
action_file_1.py (the filename is arbitrary, name it whatever makes sense to you).
- Copy all of your
from statements from the main
actions.py file and paste them into your new file.
- Cut / paste however many classes you want to move from your main
actions.py file to your new one.
- Save the file
- repeat as necessary
I’m working on an in-depth article explaining this and how I organized mine, etc, but that’s the general idea.
Here’s a screenshot of my actions folder:
And here’s an example of the top of one of these new action files with my
from statements and the beginning of the
Class I moved here.
The great thing is that you don’t need to change anything related to launching your action server, it’s the same
rasa run actions as before.