Getting Type Error but not sure why

I have the below code:

    def fill_values(key, list: list):
        if st.session_state[key]:
            logging.warning("checkbox is true")
            st.session_state[key] = list
        else:
            logging.warning("checkbox is false")
            st.session_state[key] = []

    # Create PLA filter
    if "plaCheckboxKey" not in st.session_state:
        st.session_state.plaCheckboxKey = True

    plaCheckbox = col1.checkbox("Select all Priority learning areas", key="plaCheckboxKey", on_change=fill_values, args=("plaCheckboxKey", pla_list) )

and that code gives me this error: an integer is required (got type list) and I am not sure why.

I am passing the exact same arguments in the multiselect below and not getting any error with that, so not sure why I am getting it with the checkbox.

It is bad practice to use python keywords as variable names.

1 Like

You got ( list : list ) in the parametres.
Try first to replace the first word list with another word, for exemple “my_list”. If the error persist, you can share more details about the error.

I found the problem. You have to change the key´s value of the element checkbox to another thing, Exemple key=“123”. In the case you don´t need the key in the checkbox you don´t have to give it one. I hope this solver your problem :slight_smile:

1 Like

Not sure how to close this. Error makes sense. I was just passing the wrong arguments smh. I was unable to close this out manually.