Periodic run of function

Hi all

I have a situation where session_state varaiables are being changed periodically by a another thread in the application which is in sync with the main thread (I used add_script_run_ctx for this) .

it would be nice if I could run a peridic process to check for such changes and issue a st.rerun on main thread in case of change.

currently I use โ€˜st_autorefreshโ€™ that send st.rerun every 5-seconds , but this is a waste of recources.

Being a newbie in staremlit I have a couple of questions:

  • Any other idea how to solve the issue ?
  • Do we have any such similar widget for periodic run of a fucntion ?
  • Is it possible to activate rerun from a seperate thread on the main thread ?

10x
Raz