Currently experimenting a fair bit with Streamlit as I found it has great potential.
Trying to clean up a bit my files, I tried to put functions used in other cached functions, into another module
So replacing :
@st.cache(allow_output_mutation=True) def get_data(site): return get_site_data()
import ccb @st.cache(allow_output_mutation=True) def get_data(site): return ccb.get_site_data()
the function ccb.get_site_data() returns the correct data when used at a different location.
However, inside the cached function, I get an error in streamlit:
Streamlit failed to hash an object of type <class ‘function’>.
TypeError : object supporting the buffer API required
File “c:\users\ \cbflcp~1\venv~1\lib\site-packages\streamlit\hashing.py”, line 241, in _update hasher.update(b)
I am on Win10 with python 3.7.5 and streamlit 0.51 running in a venv
I do not quite understand why the same function cannot be in a different module…
Is it due to the cache function?
Is there any way around it or all components of my cached functions need to be in the streamlit script ?
Thanks a lot,