How to fix DuplicateWidgetID: There are multiple identical st.button widgets when there are no duplicate keys in Streamlit

I am trying to Implement a pause and resume button in my program.

But I get the error: DuplicateWidgetID: There are multiple identical st.button widgets with key='pause_button' . How do I fix this when there are no duplicate keys?

Here is a snipnet of my code:

while st.sidebar.button(label="Pause", key='pause_button'):
    if st.sidebar.button(label="Resume", key='resume_buton'):
        continue
    time.sleep(10)

Or what is best way to implement a pause button in my simulation program?

1 Like

Hello John,

I’m having the same issue, did you happen to find a solution for this?

same issue, why is that?

Because the code is creating multiple identical st.button widgets with key=β€˜pause_button’`. What is not clear?

@JohnAnih

As per my understanding, you are trying to create multiple pause button with same key. my solution to you is to change the keys like pause1_button, pause2_button. here your functionality will not affecting anyways.

give a try and let us know