Routing print statements to console window

Entering the python debugger within a callback usually fails and locks up the interpreter. I’m assuming this has to do with threading. I usually have to resort to print statements in these cases which requires me switching back and forth between my editor and browser.

Would it be possible to route these messages to the console window?