import streamlit as st form_fields = st.session_state['form_fields'] form_fields['page_2_a'] = st.text_input("Enter something!", form_fields['page_2_a'] or "") form_fields['page_2_b'] = st.text_input("Enter something else!", form_fields['page_2_b'] or "") count = 0 if form_fields['page_2_a'].strip(): count += 1 if form_fields['page_2_b'].strip(): count += 1 f"Count for this page is {count}" st.sidebar.progress(st.session_state['progress']())