Functions in Multiselect Issue

Hello! I am trying to use multi select as a way to choose which functions to run. Below is some sample code. When the code is run, you’re unable to select an option. According to the docs, it sounds like I just need to pass in a Sequence for options, so I’m not sure if I’m doing something wrong or if there is another workaround for what I’m trying to achieve. Ideally, this would return a list of functions that I could then iterate through. Thanks for the help!

import streamlit as st

def first():
    pass

def second():
    pass

st.multiselect(label="Example", options=[first, second])

I would do it like this:

import streamlit as st

def first():
    pass

def second():
    pass

res = st.multiselect(label="Example", options=["first", "second"])

if res == "first": 
    first()
elif res == "second":
    second()

It’s important to realize that Streamlit is returning a value from st.multiselect, which I define as res. I would assume that the way your original code is written, you are returning the definition of first or second (literally the interpreted Python code) instead of executing it.

Best,
Randy