Have same issue with streamlit 1.8.1, having tried workaround by @whitphx, get report_thread not found. Any further workarounds? Thanks!
Edit: Found this suggestion by @velicanu resolved:
from streamlit.scriptrunner import add_script_run_ctx