I think in the context of Bokeh you will have to define the pickle class in a separate module file that you import (for both save and load). This is an issue in general with pickle, but even more so in Bokeh app code. Every session that is opened on a Bokeh server runs the code in a completely new module that has a randomized name, that is guaranteed not to match whatever originally ran the save code.