Please ensure you are using the Streamlit version 1.40.0.
1.40.0
st.pills() method does not exist in versions 1.39.0 and lower.
st.pills()
1.39.0