# Recommended way up splitting streamlit app into multiple file?

**URL:** <https://discuss.streamlit.io/t/recommended-way-up-splitting-streamlit-app-into-multiple-file/67584>\
**Category:** Using Streamlit\
**Tags:** discussion\
**Created:** [April 22, 2024, 3:29pm UTC](https://discuss.streamlit.io/t/recommended-way-up-splitting-streamlit-app-into-multiple-file/67584 "2024-04-22T15:29:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pro\_Buzz](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/pro_buzz/32/38632_2.png) [@Pro\_Buzz](https://discuss.streamlit.io/u/Pro_Buzz)\
**Post date:** [April 22, 2024, 3:29pm UTC](https://discuss.streamlit.io/t/recommended-way-up-splitting-streamlit-app-into-multiple-file/67584/1 "2024-04-22T15:29:10Z")

</div>

Hello Streamlit community,  
I am building a chatbot application for an Organization. The chatbot is calling different API’s and getting the answer back.

As we add new functionailty the size of the file is growing everyday. How should we split the application file? also I felt when i externalize some api calls into different file the chatbot caches data and I have to stop and start the chat in my localhost to see new changes. Whereas when everything is in single file there is no such issues

---

<div class="post-metadata">

**Author:** ![ferdy](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/ferdy/32/29957_2.png) [@ferdy](https://discuss.streamlit.io/u/ferdy)\
**Post date:** [April 22, 2024, 4:31pm UTC](https://discuss.streamlit.io/t/recommended-way-up-splitting-streamlit-app-into-multiple-file/67584/2 "2024-04-22T16:31:53Z")

</div>

Have you tried the multi-page feature?

> [@Pro\_Buzz](#):
>
> also I felt when i externalize some api calls into different file the chatbot caches data and I have to stop and start the chat in my localhost to see new changes. Whereas when everything is in single file there is no such issues

Could you elaborate more on that?

---

<div class="post-metadata">

**Author:** ![TomJohn](https://sea2.discourse-cdn.com/streamlit/user_avatar/discuss.streamlit.io/tomjohn/32/19953_2.png) [@TomJohn](https://discuss.streamlit.io/u/TomJohn)\
**Post date:** [April 22, 2024, 4:53pm UTC](https://discuss.streamlit.io/t/recommended-way-up-splitting-streamlit-app-into-multiple-file/67584/3 "2024-04-22T16:53:32Z")

</div>

Hi @Pro_Buzz maybe just try some modularization and modules importing?

My app [The Dungeon](https://dungeon.streamlit.app/) does something like that. Maybe not in the best way possible, but you can get the concept:

I have divided the game into `main streamlit_app.py` file and:

> import game\_config  
> import game\_js  
> import game\_def

In this way I can modyfiy things like rendering engine outside the main app. In the main app I am importing needed modules:

> <https://github.com/TomJohnH/streamlit-dungeon/blob/main/streamlit_app.py>

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/streamlit/original/3X/c/f/cf4c2ee0d938358f82448c5fe4b9c3c91d7ce19c.svg) [@system](https://discuss.streamlit.io/u/system)\
**Post date:** [October 19, 2024, 4:53pm UTC](https://discuss.streamlit.io/t/recommended-way-up-splitting-streamlit-app-into-multiple-file/67584/4 "2024-10-19T16:53:35Z")

</div>

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
