Writing Custom Actions in Separate .py files

Hello!

I wanted to know what the best practice is for organizing custom actions. My bot seems to be racking up a lot of custom actions. This makes the actions.py very long. Is there a way to break the actions.py up so that one file does not have so many Action Classes?

Thanks for any help!

Personally, I’ve organized them into four different files by function:

  1. ask.py for action_ask_slot_name
  2. validate.py for for validation
  3. main.py for regular action classes
  4. submission.py for action_submit_form_name actions

You can break them down as much as you like as long as you keep them mounted inside the actions directory in the right place in your docker container if you are using docker.

In other words, it’s safe to break down these functions to as many files as you like, and it’s safe to place them wherever your current actions.py file is.

1 Like