Another session_state question

  1. Can someone explain the difference between the above the thread I shared in the description?

I cannot answer exactly but I suspect this has to do with session_state being managed per-session somewhere in the Streamlit internals. The ‘real’ session state does not store the value of the a key in a dictionary like session_state['a'], but a copy of session_state for each unique session_id identifiers. The getter and setter methods for the session_state that you see make sure that when you assign ss.button = True, it only happens for the current session.

If you want the alias, I would simply from streamlit import session_state as ss.

2 Likes