# Match the text editor to the active object's name

Does anybody know how I could, from the 3D view and with a customized shortcut, automatically open, in the text editor, a .txt file whose name is the same() as the one of the active object?

()Most objects are instanced and their names are followed by '.r'/'.l'; this part should be ignored.

• Suggest start from the Simple Operator template in text editor > templates > python and try something like text = bpy.data.objects.texts.new(context.object.name) Sep 15 at 12:44
• Related adds a text block with the geometry to create the acitve object. blender.stackexchange.com/questions/65129/… Please edit any extra details into question, and where your efforts are at so far. Sep 15 at 14:42
• Ok, I tried the script of the link and it actually creates a new .txt file. In my case, I want to open a .txt file that already exists, and that has the same name as the active object. Sep 15 at 16:46
• Yep got it. . It's a pretty simple script to write. Sure someone will write it for you, as an answer in due course. Sep 15 at 17:03
• Does it have to be a .txt files? It would be better IMO to use a .json format. It would be cleaner for organizing the data and making modifications using python. Sep 18 at 11:25