Calling st.experimental.rerun() in another thread

I understand that calling st.experimental_rerun would typically rerun the script immediately. I am having this error when I try to rerun the script in another thread.

file “/usr/local/lib/python3.8/site-packages/streamlit/__ init__.py” line 559 in experimental_rerun
raise RerunException(_RerunData(None))
streamlit.script_runner.RerunException : Rerun(query_string=None, widget_states=None)

Anyone come across this error before?