'Is there a way to change the prompt on an embedded IPython shell, or to run an arbitrary function before the shell returns to the next prompt?

I am embedding an IPython Shell into my python program as a way to interact with that internal state directly (I am building a debugger). Every time the shell return for input (by printing [1]: for example), I want to be able to display some internal state of the system by calling a function that prints some values. I there any way to do this?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source