# How to add a new Text Editor template?

In Blender's built-in Text Editor, there's a Templates menu at the bottom with a bunch of pre-built templates for scripting addons. However, I have created a few new templates myself that I use frequently. Is there any way for me to add my templates to this menu?

In [version_number]/scripts subfolder of your Blender installation, or in any additional path(s) for scripts you've set in User Preferences, there's a folder templates_py (and one for osl too). Just put the templates there; in the menu, each _ in the file name will be converted into a space and each beginning letter of a word capitalized.

• Very trivial note ;), the beginning letter gets uppercased and also the first letter that comes after a number. – iKlsR Jul 8 '13 at 1:28
• Ha! Never realized the number-prefix bits :D – Adhi Jul 8 '13 at 1:47

The Templates > Python menu item is getting quite long now.

### 1. x_templates

To make menu items all you have to do is add folders and files into the add-on's folder. The add-on does the rest.

Each of these folders (except the __pycache__ folder) contains some number of .py files.

self.path_menu(fullpath, "text.open", {"internal: True})

like this

bl_info = {
"name": "Extra Templates",
"author": "you",
"version": (0, 1),
"blender": (2, 7, 6),
"category": "Text Editor"
}

import bpy

bl_label = "My Python"

def draw(self, context):
bpy.utils.script_paths("templates_my_py"),
"text.open",
{"internal": True},
)

def draw_item(self, context):
layout = self.layout

def register():
bpy.utils.register_module(__name__)
bpy.types.TEXT_MT_templates.append(draw_item)

def unregister():
bpy.utils.unregister_module(__name__)
bpy.types.TEXT_MT_templates.remove(draw_item)

if __name__ == "__main__":
register()