Keep DataFrames objects between sessions in a thread-based program

I have a Streamlit app that has 3 DataFrames initialized the global environment.

I have 3 Threads corresponding to each DataFrame, their job is to get some data via TCP/IP and add it to the DataFrame.

After the update of the DataFrame, I use 3 tabs to show each one using st.DataFrame.

This works flawlessly, but now I need to be able to actually keep the data even if the user refreshes the page.

according to this post, it is not safe to call anything related to Streamlit’s API inside those threads, so st.session_state and st.cache_data are not an option.

Iv’e tried extra-streamlit-components cookie mechanism but it doesn’t support DataFrames.

Is there a reliable way to do it?

Why not save the data in a file?

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