Early return in streamlit script

Hello,

Is there any funciton

streamlit.quit()

The terminates the execution of the script in that point, without raising errors?

The behaviour can be emulated with if conditions, but not always in a clean way.

Something like this would be very handy:

...

if condition:
    st.quit() 

...

Hi @luca:

Eventually we plan to have st.stop:

but for now you can use the following undocumented incantation, which may change at a future date:

raise st.ScriptRunner.StopException

Cheers!

4 Likes

Thank you, I missed that feature request!