hey
i want streamlit to re-import my modulesâspecifically, some imported variablesâwhen the user refreshes the page.
currently, the only workaround that i found is re-running the script, but i donât want to do this all the time. also, st.rerun()
only seems to re-initialize the st.session_state
object. moreover, iâd need to execute this re-initialization only with refreshingsâwhich may or may not include a manual st.rerun()
.
here is what i tried:
if "reload" not in st.session_state:
st.session_state.reload = True
del my_variable
from my_module import my_variable
weirdly, this doesnât seem to perform the import operation at allâalthough the block runs.
iâm not accesing this variable from st.session_state
, but i think it would be the same, because i would instantiate it with the previously imported variable that iâm not being able to re-import.
thx