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