Create dynamic number of progress bars inside st.status that updates using while loop


I want to create a number of progress bars inside an st.status element dependant on a dynamic list.
Inside the st.status, I want to run a while loop that will update all the progress bars created until they are all finished. This is all based on API calls - so I keep calling the API until I get the response I want.

The problem is the progress bars just keep appending to st.status. So for example, if I have a list of 3 elements, I want 3 progress bars that keep getting updated. Instead I just get an infinite number of them until they are all finished.

Any help will be much appreciated!

I am running the app locally
python 3.11

Hi @Carhum

Have you tried creating a placeholder

placeholder = st.empty()

Then whenever the progress bar changes status, you can assign it to overwrite the placeholder variable. This should allow the progress bar to not spawn up which each update as you had encountered.

Hope this helps!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.