I am also interested in doing this.
For my application, I am interested in replicating something similar to the developer console provided in PyMOL, a visualization and analysis software for molecules:
At the top of the interface you can see my type print('hello world')
into the console.
Following the rabbit hole, I found this thread, where @rdb suggested looking at the developer console in the game Naith. I found the project and the relevant code.
I have not yet tried to run this code, but I’ve written this post mostly as a note for myself, so that one day I can return to this problem. If anyone in the meantime is able to produce a minimal example of a developer console using this code, please post your solution here–it would be greatly appreciated.