How do I pass args in a callback function?

I think an example in here would be fitting, I’m not aware of how to do this properly.

I suspect it’s similar to how Python programs do it but I’m not that well versed in that aspect of Python

Figured out how to do it on my end, but still think it should be added to docs.

My code that worked:

def callback(lat, long):
    st.session_state.gps_latitude = lat
    st.session_state.gps_longitude = long

st.sidebar.button(f"Set GPS to {target_obj.latitude}, {target_obj.longitude}",
                                     key=random.random(), on_click=callback, args=[target_obj.latitude,target_obj.longitude])

Hi @kevinlinxc :wave:

Examples of using args and kwargs in callbacks are found in this doc:

Best, :balloon: