How to type in script editor window when mouse cursor elsewhere?

I’m very new to blender, using it for robotics, so primarily drawing using python very little hand-drawing.

When I am typing away in the script editing window and my mouse cursor drifts outside this window, I can no longer type, and I have to manually push my mouse cursor back in, even if the text cursor (|) is still in the editor window. Is there a way to change this default behavior?

My hunch is that the correct answer is “This is designed that way because there is all sorts of hotkey action and such, and if the mouse cursor is in the viewport, the designers wanted you to be able to enter the hotkeys to work on the scene.” I just wish I could change this (reasonable) default behavior for when I’m entering scripts by hand.

Not without changing the source code. It’s an old behaviour from blender to focus automatically on the workspace under the mouse cursor, and is intended to speed up the work process.

However it may be possible to lock the mouse cursor inside the text editor space with python, and force the editor to stay in focus. (I haven’t tried this but there’s no reason not to work)

usually I do text editing outside in a real text editor then saved in py file
and in bl text editor I simply reload the file and run it

much easier and faster I think

happy bl