Skip to content

Instantly share code, notes, and snippets.

@tvst
Created May 20, 2020 20:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tvst/f6ab192d4952757959f026007aadef6a to your computer and use it in GitHub Desktop.
Save tvst/f6ab192d4952757959f026007aadef6a to your computer and use it in GitHub Desktop.
Function to detect if the current script is running inside Streamlit
import threading
def is_running_in_streamlit():
thread = threading.current_thread()
return type(thread).__module__.startswith('streamlit.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment