StreamlitAPIException Error when st.plotly_chart is used within the plotly_mapbox_events

Hi community, I’ve got the following error when use st_plotly_chart within the plotly_mapbox_events. Please advice. Thanks

StreamlitAPIException: to_json() is not a valid Streamlit command.

mapbox_events = plotly_mapbox_events(
st.plotly_chart(fig, use_container_width=True),
click_event=True)

Hi @Cassie_Leong

to_json() appears to be a Pandas method for saving a DataFrame as a JSON file. Could you check if those lines are error free. Also instead of using st.plot_chart() inside plotly_mapbox_events() could you try using a comparable native plotly method.

Best regards,
Chanin