Import file auto refresh

I organized my code in two files 1) app.py 2) logic.py Where app.py is primarily streamlit UI interface to take input and display output . where logic.py is functional code for the app .

app.py
import streamlit as st
import logic as lg
…
…

running streamlit app

streamlit run app.py

Without stopping the streamlit server , when changes are made to app.py , streamlit identifies the modificaton to the app.py and ask for rerun

However , when changes are made to logic.py , i have to stop the server and restart streamlit app to reflect the changes in logic.py .

Is there a way streamlit can autorefresh changes in import files ( to avoid stop and restart of app)?

Hey @dataexplorer,

is the directory structure for your code as follows:

dir_to_code/
----> app.py <β€” your Streamlit interface
----> logic.py <β€” code that does things

Then, as you said you import logic as lg into your app.py file. But when you update logic, the app does not auto refresh like it does with your main app.py script?

Can you answer these questions for me:

  • Streamlit version
  • Pip / conda version
  • computer IOS
  • default webbrowser

Thanks,
Marisa

Yes , you got the directory structures right and also the issue

streamlit version : 0.75
pip 20.2.4
IOS : Win10
Webbrowser : Chrome

1 Like

Hey @dataexplorer,

I just wanted to checkin and let you know we are taking a look at this. I will update you when we know more about what is going on!

Thanks,
Marisa

1 Like

Hi Marisa, I am having the same issue in Streamlit version 0.80.0, pip 20.0.2, Ubuntu 20.04

I have the same problem with the latest version on Ubuntu and Chrome.

I have the same problem on 0.84.0 in Ubuntu (in a docker container) viewed on Chrome and Firefox