I think it's possible to embed IPython instances in Python programs and 'connect' to them with a console/notebook/qt-console. I tried the IPython docs but didn't get to it.
I would like to start IPython in a 'regular' Python program, give it access to the program's namespace, connect with a IPython notebook and continue the Python program after I closed/quit the notebook.
dataframe = run_some_program_get_data()
# start IPython with access to 'dataframe'
# continue program with dataframe
dataframe.to_csv('file.txt')
How can I start an IPython kernel in a normal Python program? And how can I set to which kernel an IPython notebook should connect?