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?