I am using ipython widgets in my jupyter notebook. Now when kernel is restarted, the widget state is lost and a message is displayed:
“Jupyter widget could not be displayed because the widget state could not be found. This could happen if the kernel storing the widget is no longer available, or if the widget state was not saved in the notebook. You may be able to create the widget by running the appropriate cells”
So when a user reopens his notebook after a kernel restart, he doesn't find the widget in the notebook that he had earlier. We want to save all widgets state so the after kernel restart when user reopens the notebook, he finds all his widgets intact.
PS: There is "save widget state" menu option which does that but that is a manual step and we want widgets state to be saved through our python code.