In case anyone else may find it useful, attached is a small modification of the qt in-process example that implements the behavior I was looking for. The namespace gets updated each time the mouse enters the widget, so every time you use the console, the environment appears to be the same as that of the GUI.<br><br><div class="gmail_quote">On Sat Jan 10 2015 at 9:03:48 AM Darren Dale <<a href="mailto:dsdale24@gmail.com" target="_blank">dsdale24@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I found the start of a solution by digging into the IPython library, especially <a href="https://github.com/ipython/ipython/blob/master/IPython/kernel/zmq/ipkernel.py#L33" target="_blank">https://github.com/ipython/<u></u>ipython/blob/master/IPython/<u></u>kernel/zmq/ipkernel.py#L33</a> . After creating the in-process kernel, it is possible to reinitialize the console namespace with, for example, `kernel.user_ns = globals()`. Now its just a matter of wiring up the gui so the user_ns gets updated whenever the console widget receives focus.<br><div class="gmail_quote">On Fri Jan 09 2015 at 11:38:33 AM Darren Dale <<a href="mailto:dsdale24@gmail.com" target="_blank">dsdale24@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="gmail_quote">On Sat Jan 03 2015 at 10:45:42 AM Darren Dale <<a href="mailto:dsdale24@gmail.com" target="_blank">dsdale24@gmail.com</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Ray,<br><br><div class="gmail_quote"></div><div class="gmail_quote">On Sat Dec 27 2014 at 8:48:20 PM Osborn, Raymond <<a href="mailto:rosborn@anl.gov" target="_blank">rosborn@anl.gov</a>> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div style="word-wrap:break-word">
I don’t really understand what you are trying to achieve, but the ‘user_ns’ dictionary isn’t an isolated namespace - it’s the namespace that is used by the console, and I would have thought you would have to do some kind of injection to add other objects from
 within the application.</div></blockquote><div><br></div></div><div class="gmail_quote"><div>What I am trying to achieve is explicitly documented at <a href="http://ipython.org/ipython-doc/dev/interactive/reference.html#embedding-ipython" target="_blank">http://ipython.org/ipython-<u></u>doc<u></u><u></u>/dev/interactive/reference.<u></u>htm<u></u><u></u>l#embedding-ipython</a> :</div><div><br></div><div>---</div><div> It is also possible to embed an IPython shell in a namespace in your Python code. This allows you to evaluate dynamically the state of your code, operate with your variables, analyze them, etc. Note however that any changes you make to values while in the shell do not propagate back to the running code, so it is safe to modify your values because you won’t break your code in bizarre ways by doing so.</div><div><div><br></div><div>Note</div><div>At present, embedding IPython cannot be done from inside IPython. Run the code samples below outside IPython.</div><div>[DD: I am not attempting to embed ipython from inside ipython]</div><div><br></div><div>This feature allows you to easily have a fully functional python environment for doing object introspection anywhere in your code with a simple function call. In some cases a simple print statement is enough, but if you need to do more detailed analysis of a code fragment this feature can be very valuable.</div><div><br></div><div>It can also be useful in scientific computing situations where it is common to need to do some automatic, computationally intensive part and then stop to look at data, plots, etc. Opening an IPython instance will give you full access to your data and functions, and you can resume program execution once you are done with the interactive part (perhaps to stop again later, as many times as needed).</div></div><div><div>The following code snippet is the bare minimum you need to include in your Python programs for this to work (detailed examples follow later):</div><div><br></div><div>   from IPython import embed</div><div>   embed() # this call anywhere in your program will start IPython</div><div><br></div><div>You can also embed an IPython kernel, for use with qtconsole, etc. via IPython.embed_kernel(). This should function work the same way, but you can connect an external frontend (ipython qtconsole or ipython console), rather than interacting with it in the terminal.</div></div><div>---</div><div><br></div><div>This is impressively simple for the embed function:</div><div><br></div><div>---</div><div><div>C:\Users\darren> python</div><div>Python 2.7.8 |Continuum Analytics, Inc.| (default, Jul  2 2014, 15:12:11) [MSC v.1500 64 bit (AMD64)] on win32</div><div>Type "help", "copyright", "credits" or "license" for more information.</div><div>Anaconda is brought to you by Continuum Analytics.</div><div>Please check out: <a href="http://continuum.io/thanks" target="_blank">http://continuum.io/thanks</a> and <a href="https://binstar.org" target="_blank">https://binstar.org</a></div><div>>>> from IPython import embed</div><div>>>> a=1</div><div>>>> embed()</div><div>Python 2.7.8 |Continuum Analytics, Inc.| (default, Jul  2 2014, 15:12:11) [MSC v.1500 64 bit (AMD64)]</div><div>Type "copyright", "credits" or "license" for more information.</div><div><br></div><div>IPython 2.3.1 -- An enhanced Interactive Python.</div><div>Anaconda is brought to you by Continuum Analytics.</div><div>Please check out: <a href="http://continuum.io/thanks" target="_blank">http://continuum.io/thanks</a> and <a href="https://binstar.org" target="_blank">https://binstar.org</a></div><div>?         -> Introduction and overview of IPython's features.</div><div>%quickref -> Quick reference.</div><div>help      -> Python's own help system.</div><div>object?   -> Details about 'object', use 'object??' for extra details.</div><div><br></div><div>In [1]: a</div><div>Out[1]: 1</div></div><div>---</div><div><br></div><div>But I have not been able to achieve the same behavior with the qt in-process console.</div></div></blockquote></div></blockquote></div></blockquote></div>