Preserving state across sidebar pages

Hello @Codeguyross,

Ah, the example uses an outdated version of his session states which has been fixed. Save the original session state code into SessionState.py file, and follow the usage:

>>> import SessionState
>>>
>>> session_state = SessionState.get(user_name='', favorite_color='black')
>>> session_state.user_name
''
>>> session_state.user_name = 'Mary'
>>> session_state.favorite_color
'black'
Since you set user_name above, next time your script runs this will be the
result:
>>> session_state = get(user_name='', favorite_color='black')
>>> session_state.user_name
'Mary'
1 Like