Radio Button not working as expected/not updating between user interactions

I am working on a Streamlit app and am at a loss for why it is not working.

My idea was to create an app that plays a game of 20 questions, where the user thinks of a person or thing and the app provide a UI to interact with a chatbot and answer Yes/No questions. My app seems capable of going through a series of questions and asking the chatbot correctly. The problem is that the user input from a radio widget is not being properly used and updated between questions. There is no error since the app can run, but it clearly not working as expected.

Additional Info:

  1. I am running this locally
  2. A non-working version of my .py script can be found on my github:

https://github.com/diegoegalvan/twenty_questions

  1. I am using Python 3.10.12 and streamlit 1.42.0

Fun idea!

Would you be against moving away from st.radio and instead using two st.button’s? This might help with what seems to be session state problems.

Alternatively, if this does not work you may want to consider using st.form as it enables more control of page reruns and field entry reading.