this addon can be useful for script that need some real time features. it can logs keyboard and mouse events, frame change during animation renders (timer event), it can change the speed of it while running (there’s a trick), it cares about instance multiplication (only one running at a time even if you try to start it again and again).
there’s also some code to use a script event logger. and a popup that appear whatever the context is (can be called from global, the console or a function for example).
bpy.context.window_manager.modal.status = True
bpy.context.window_manager.modal.timer = True
bpy.context.window_manager.modal.timer_refresh = 0.2
bpy.context.window_manager.modal.hud = False
bpy.context.window_manager.modal.func = ‘myModalFunc(self,context,spam)’
all realtime and no crash (aha just kidding : no crashes when your script is properly connected with it )