Session_state issue

Hey guys!
I’ve created a streamlit app where I want to change pages on sidebar button clicks.
Here is the code for buttons and the session_state setup.

class pages(enum.Enum):
    main = 1,
    inspection = 2,
    history = 3,
    settings = 4

if 'settings_value' not in st.session_state:
    st.session_state.settings_value = 0
if 'page' not in st.session_state:
        st.session_state.page = pages.main


def update_session(page):
    
    st.session_state.page = page
    st.text("sesssion = " + str(page))

def update_settings(settings_value):
    st.session_state.settings_value = int(settings_value)

main_btn = st.sidebar.button('Main')
inspection_btn = st.sidebar.button('Current inspection')
history_btn = st.sidebar.button('History')
settings_btn = st.sidebar.button('Settings')

When I change the page - it works, but when I interact with a slider on one of the pages it reruns the app and nothing is displayed, although I see that st.session_state is set to the main.
What can be the problem here? thanks!

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