Streamlit
Streamlit Session State: Keep Values Between Reruns
Streamlit reruns your script on every interaction, so ordinary variables reset. st.session_state keeps values between reruns. Here is how to initialize it, update it with callbacks, and avoid the common errors.