[IPython-dev] embedding ipython, namespace question

Darren Dale dsdale24 at gmail.com
Sat Dec 27 15:31:36 EST 2014


Hello,

(sorry for double-posting on ipython-user. I was advised to post here
instead.)

I'm working on embedding an ipython qtconsole in my applilcation as a dock
widget. The
https://github.com/ipython/ipython/blob/master/examples/Embedding/inprocess_qtconsole.py
example
was a helpful first step. As variables are created or updated in the main
application, I'd like to be able to inspect them in the qtconsole. Is it
possible for the qtconsole's namespace to be shared or linked with that of
the main application? It seems like this should be possible, based on the
documentation for
http://ipython.org/ipython-doc/1/api/generated/IPython.terminal.embed.html#IPython.terminal.embed.InteractiveShellEmbed
.
I'm creating my kernel and client at the beginning of my module, and then
wiring up the widget when my application's main window is about to show.
But if I run `dir()` in the embedded ipython qt console, the list is
identical to what I get if I run `dir()` in the standalone `ipython
qtconsole` program.

I've seen some comments along the lines of "pass a user_ns", but I have no
idea what this means, or specifically how to do it.

Thanks,
Darren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20141227/4632fc49/attachment.html>


More information about the IPython-dev mailing list