How share a file between two apps in same repo?

I use a file which I want to share between my apps in the same repo. But any changes in file by any app do not appear in another app. They are using their own version of that file and it means the file is not shared between two or more apps in the same repo.
What I need to do?

Hard to know with the limited information. Are you using st.cache / st.experimental_singleton / st.experimental_memo ?
How are you accessing the file?

1 Like

No, I do not use them. I just use pure python read and write. I have three files like app1.py, app2.py, result.json. app1 update some fields in result.json file and app2 read that file and try to apply that results. But, whatever app1 write in result.json cannot be seen what is reading from app2. It uses the version of result.json which has been published on github.

Well without an example code it is tricky to diagnose, but I guess the things I would suggest are:

a) make sure that app2 is re-reading the data again after the file has been modified
b) make sure that app1 is saving the data to the same json file in the same location as it reads the data

Good luck!

1 Like

Here is a test that I run on streamlit:

app1:
https://m-amrollahi-test-streamlit-test-jes1k8.streamlitapp.com/

app2:
https://m-amrollahi-test-streamlit-test2-ssx6f1.streamlitapp.com/