Created
May 20, 2020 20:35
-
-
Save tvst/f6ab192d4952757959f026007aadef6a to your computer and use it in GitHub Desktop.
Function to detect if the current script is running inside Streamlit
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
Thank you very much! It helped me.