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