I want to add an interactive console to debug a running python progam. I want to be able to "call" custom commands (but not external system programs) and interact with instances and statuses of my program.
I basically need an "SSH server" built into my python program.
I could write a TCP server, a parser and everything else all I need, but since I will be in a shell I would also like other things like "autocompletion" and "history", and, why not, authentication... Things that would involve some more advanced vt100 commands like bold/highlights, write and delete lines and chars.
Is there anything already done?
You can check if the code module from the standard lib helps you here. It provides the InteractiveConsole and InteractiveInterpreter classes, as well as some convenience function.
A very simple example:
When running code, an interactive shell will open, you can find
fooindir(), run it and so forth.