Session_state won't work in mupli page app

Hello
I have multi page app
In the main page I have a user input to save the username is session state, after I go to second page and I need to use the session state username…for some reason the session state variable is empty?!

Any information associated to a key in session state that is also used for widget will get deleted when the widget disappears. (This also applies if you assign the same key to a different widget in a different page.)

If you want something to persist across pages, sign it to a key not used for any widget. (Otherwise, you have to copy each key you want to maintain at the top of every page :
st.session_state.my_key =st.session_state.my_key

If that doesn’t help, please share your code so we can see what problem you are having.

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