Cannot pass st.empty() as a placeholder to a callback function


I want to be able to update the top of my page when there is an update, or any processing going on.
For that, I’ve created a placeholder with st.empty():

# head
placeholder = st.empty()

Then I pass it to a callback function associated with a form.

with st.form(..):
    st.form_submit_button("Persist", on_click=persist_changes, args=(placeholder))

But on running this I’m getting this error:

TypeError: __main__.persist_changes() argument after * must be an iterable, not DeltaGenerator

On using st.container, the app runs in infinite reloading loops.


What if you pass it in a tuple? Instead of args=(placeholder), do args=(placeholder, )

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