Script text editor bug

Hi,

With the blender text editor you can write python scripts. But I have a problem. As soon the mouse hovers over a different area of blender, the text editor looses focus and all text entered are interpreted by blender to be blender key commands.
This potentially ruins your project…

Has anybody else experienced this problem and knows how to fix it?

Gr,

Michiel

Yes, every time, especially when I need to copy the text and paste it somewhere else. I press ctrl-c and I certainly don’t think about where my cursor is at this time. But this is not a bug, this is how the Blender is designed. This is the concept of Editors, or something like that.

I understand it could also be considered a feature. But while editing text i find it rather annoying. I found a way ro minimize the problem though. If you hit ctrl-spacebar you maximize the text editor area which helps to prevent losing focus.

Another issue is that the contents of this window is actually the data present in the internal cache (DNA) of blender. So of you save the python script, but don’t save the prject you will get the old state of the python script after closing and opening blender again.

Another issue I found is that if you do:
import sys
import bpy
sys.path.append(bpy.path.abspath(’//scripts’)
import mylib #load mylib from scripts dir

You need to close blender again to force it to parse mylib again.

Input focus follows the area under the mouse everywhere in Blender. So it indeed also works that way for the text editor as well. It can be a bit annoying, but I find you get used to it. Another approach could be to use an external editor to edit the script, see Tips and Tricks — Blender Python API.

Perhaps using Tips and Tricks — Blender Python API is a better way to use a script on disk within blender.

It’s mentioned in the manual section on the Python API how to deal with this: Tips and Tricks — Blender Python API

1 Like

@MichielM Megathread listing numerous add-ons to workaround most of the shortcomings of the Text Editor(since it’s in maintenance only mode):

1 Like