# Can unofficial Blender addons be included in a project as a text block and automatically register on load?

I am a keen user of Bassam's typewriter.py addon. It's not part of the official distribution, so I thought I could make my .blend projects more portable by including it as a text block.

I always need to run the block even though I checked the register checkbox. Are there any more requirements to having the .py extension that I need to do before the script will run on load?

Yes, if the addon is a single file (rather then a python package containing an __init__.py file).

At the end of the script, remove these two lines:

if __name__ == "__main__":
register()


register()

In Python __name__ refers to the module name, which in this case is the name of the textblock (without .py, however if you run the script directly __name__ will be "__main__").