TypeError: 'str' object is not callable

Hi @abhikpalli :wave:

Unfortunately, the code sample you’ve provided does not reproduce the error you’ve described.

Running the following:

# code sample 1 :
import streamlit as st

with st.form(key="my_form_to_submit"):
    user = st.text_input("Enter some value here ")
    submit_button = st.form_submit_button(label="Submit")
    st.write(user)

# code sample 2 :
import streamlit as st

with st.form(key="my_form_to_submit"):
    user1 = st.text_input("Enter some value here ")
    submit_button = st.form_submit_button(label="Submit")
    st.write(user1)
if submit_button:
    st.write(user1)

# code sample 3 :

import streamlit as st

result = st.text_input("Enter some value here ")
if st.button("asas"):
    st.write("Hello")
    st.write(result)

results in:

2022-09-28 15:14:23.340 Uncaught app exception
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 562, in _run_script
    exec(code, module.__dict__)
  File "/Users/skekre/Downloads/streamlit-misc/string-error.py", line 12, in <module>
    with st.form(key="my_form_to_submit"):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/streamlit/runtime/metrics_util.py", line 231, in wrap
    result = callable(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/streamlit/elements/form.py", line 190, in form
    raise StreamlitAPIException(_build_duplicate_form_message(key))
streamlit.errors.StreamlitAPIException: There are multiple identical forms with `key='my_form_to_submit'`.

To fix this, please make sure that the `key` argument is unique for
each `st.form` you create.

Running the samples individually also doesn’t result in the TypeError: ‘str’ object is not callable. :confused:

How to create a Minimal, Reproducible Example