I'm using a Jupyter notebook (Python2 kernel) to display the results of simulations that depend on a local library mylib that I've written. In the notebook, I have
[1] ## import library
import mylib
[2] ## run simulations
X = mylib.simulateX()
Y = mylib.simulateY()
Z = mylib.simulateZ()
[3] ## plot data
mylib.disp_data([X,Y,Z])
I often find myself making changes to one of the methods, say simulateY, but wanting to retain the results of existing simulations X and Z (or even just changing disp_data). That is, I'd like to reimport my library after changing the source code of simulateY to generate newY but still have access to X and Z. Is there a way to do this without writing X and Z to a file?