Debug Console not showing 'Live' Outputs

Use system.util.invokeAsynchronous() to run the function in the background and use a logger from system.util.getLogger() instead of print.

And absolutely do not call any component methods from that background thread. More information here: