Accessing streamlit states/variables from another script?

I’m looking to create an app where Streamlit will be used as a web-based settings window that I can use to update the variables / settings that another script will use in real-time (eg. the target position of a servo motor).

Is there a recommended way of sharing the state/value of a widget between Streamlit and another script running on the same machine (either inside or outside a venv)? Ideally you’d be able to have multiple concurrent users that have access to the settings window and can independently control the values.

Currently my plan would be to have something like watchdog monitor a settings file modified by the Streamlit app. streamlit_server_state would be used to share the data between multiple tabs/pages.

Thanks in advance for any suggestions! Also this would be very development/prototype focused, so experimental suggestions are welcome.