The selectbox keeps the state of the last session, even if the code tells it to change its status

Hi, I have a selectbox that gives me options of what keys I need to read inside a yaml file.
When reading this key, I configure a checkbox with True or False, depending on what is in the key of the yaml file.

This works fine as long as I have no interaction with the checkbox on the page.
If I click on the checkbox in the page, the next choice in the selectbox doesn’t obey what I’m reading from the file yaml, it keeps what I did in my last interaction with the checkbox.

How do I make the checkbox always obey what is in the file yaml. It is the code below that I use to configure the checkbox.

if selected_user in data['preauthorized']['chatbot']:
    with col5:
        st.session_state.chatbot = st.checkbox('Chatbot', value=True)
else:
    with col5:
        st.session_state.chatbot = st.checkbox('Chatbot', value=False)

The behavior I expect is that the checkbox always loads with what comes from the yaml file, regardless of my interaction with the Checkbox on the page. Thanks

Hi @Luis_Henrique_Caloi

Thanks for your question. However from your question, it is not clear what are the contents of selectbox and how clicking on the checkbox breaks the code. Can you ensure that the code snippet allow us to reproduce your described situation so that we can help see and provide feedback.

Thanks!