#14968·streamlit

Allow `st.rerun(scope="fragment")` from parallel fragments during full-app runs

Author: sfc-gh-lwilby-1Created Apr 29, 2026Updated Sep 26, 2026
Labelstype:enhancementfeature:st.fragment

Current behavior

st.rerun(scope="fragment") raises a StreamlitAPIException during full-app runs, even when called from within a parallel fragment.

Why it's disallowed today

The guard in _new_fragment_id_queue() (in lib/streamlit/commands/execution_control.py) was introduced because the correct behavior was unclear for sequential fragments:

  • Blocking: Rerunning the fragment immediately blocks subsequent script content from executing — the main thread is stuck in the fragment's while loop.
  • Deferring feels wrong: Waiting until the full run completes to rerun the fragment defers the st.rerun() call in a confusing way.
  • Ignoring scope: Rerunning the full app ignores the scope argument entirely.

Why parallel fragments change the picture

For parallel=True fragments, the first concern doesn't apply — the main thread continues immediately after dispatching the fragment to a worker thread. A local rerun in the worker (re-executing wrapped_fragment() via continue in the while loop) is self-contained:

  • It doesn't block downstream script content
  • It doesn't affect sibling fragments
  • It doesn't require coordination with the main thread

Open questions

  • What use cases benefit from this? Potential examples include polling loops, retry logic, or conditional re-execution within a parallel fragment. If you have a use case for this, please share it in the comments — it will help us prioritize.

Note

This is a tracking issue for future consideration and not a planned feature extension. The parallel fragments MVP preserves the existing behavior (raising StreamlitAPIException).