# How to manage a lot of actions in actions.py

**URL:** <https://forum.rasa.com/t/how-to-manage-a-lot-of-actions-in-actions-py/50870>\
**Category:** Rasa Open Source\
**Created:** [January 25, 2022, 1:00pm UTC](https://forum.rasa.com/t/how-to-manage-a-lot-of-actions-in-actions-py/50870 "2022-01-25T13:00:30Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sajjadmanal](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sajjadmanal/32/18330_2.png) [@Sajjadmanal](https://forum.rasa.com/u/Sajjadmanal)\
**Post date:** [January 25, 2022, 1:00pm UTC](https://forum.rasa.com/t/how-to-manage-a-lot-of-actions-in-actions-py/50870/1 "2022-01-25T13:00:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![E-dC](https://avatars.discourse-cdn.com/v4/letter/e/9fc348/32.png) [@E-dC](https://forum.rasa.com/u/E-dC)\
**Post date:** [January 25, 2022, 2:08pm UTC](https://forum.rasa.com/t/how-to-manage-a-lot-of-actions-in-actions-py/50870/2 "2022-01-25T14:08:53Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![Sajjadmanal](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sajjadmanal/32/18330_2.png) [@Sajjadmanal](https://forum.rasa.com/u/Sajjadmanal)\
**Post date:** [January 25, 2022, 2:50pm UTC](https://forum.rasa.com/t/how-to-manage-a-lot-of-actions-in-actions-py/50870/3 "2022-01-25T14:50:07Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![simonm3](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/simonm3/32/17865_2.png) [@simonm3](https://forum.rasa.com/u/simonm3)\
**Post date:** [January 25, 2022, 3:03pm UTC](https://forum.rasa.com/t/how-to-manage-a-lot-of-actions-in-actions-py/50870/4 "2022-01-25T15:03:20Z")

</div>

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/”.

---

<div class="post-metadata">

**Author:** ![E-dC](https://avatars.discourse-cdn.com/v4/letter/e/9fc348/32.png) [@E-dC](https://forum.rasa.com/u/E-dC)\
**Post date:** [January 25, 2022, 3:09pm UTC](https://forum.rasa.com/t/how-to-manage-a-lot-of-actions-in-actions-py/50870/5 "2022-01-25T15:09:13Z")

</div>

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

```nohighlight
actions/ __init__.py
       /some_common_code.py
       /actions1.py
       /actions2.py
       /actions3.py

```

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

---

<div class="post-metadata">

**Author:** ![Sajjadmanal](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sajjadmanal/32/18330_2.png) [@Sajjadmanal](https://forum.rasa.com/u/Sajjadmanal)\
**Post date:** [January 27, 2022, 12:55pm UTC](https://forum.rasa.com/t/how-to-manage-a-lot-of-actions-in-actions-py/50870/6 "2022-01-27T12:55:27Z")

</div>

Thanks @E-dC

---

<div class="post-metadata">

**Author:** ![Sajjadmanal](https://dub1.discourse-cdn.com/flex013/user_avatar/forum.rasa.com/sajjadmanal/32/18330_2.png) [@Sajjadmanal](https://forum.rasa.com/u/Sajjadmanal)\
**Post date:** [January 27, 2022, 12:56pm UTC](https://forum.rasa.com/t/how-to-manage-a-lot-of-actions-in-actions-py/50870/7 "2022-01-27T12:56:26Z")

</div>

Thanks @simonm3
