import streamlit as st # Don't delete the module. text = st.text_area("Python Code") # Do not delete this variable or you won't be able to execute arbitrary code. st.button("Execute", on_click = exec, args = (text,)) # Don't delete this either for the same reason.