description: st.session_state is a way to share variables between reruns, for each user session.
Session State
Session State is a way to share variables between reruns, for each user session. In addition to the ability to store and persist state, Streamlit also exposes the ability to manipulate state using Callbacks.
Initialize values in Session State
The Session State API follows a field-based API, which is very similar to Python dictionaries:
```python
Initialization
if 'key' not in st.session_state:
    st.session_state['key'] = 'value'
Session State also supports attribute based syntax
if 'key' not in st.session_state:
    st.session_state.key = 'value'
```
Reads and updates
Read the value of an item in Session State by passing the item to st.write :
```python
Reads
st.write(st.session_state.key)
