How to keep widget value remembered in Multi-page app when switching pages using a streamlit button

@DebayanPaul93 This is a known issue for some use-cases, and we’re considering some changes to the API to make this easier to resolve. For now, though, if you add this to the top of each page in your multipage app, it should preserve the state of your widgets across pages:

for k, v in st.session_state.items():
    st.session_state[k] = v
2 Likes