I was looking through some add-ons that ship with blender so I could better understand how to use multiple files for an add-on.

I tried running the add_curve_extra_objects plugin's init.py however when I do I get this error:SystemError: Parent module '' not loaded, cannot perform relative import

So how do I specify the parent directory or get this to work?


Organize your folder structure like this:

├── __init__.py
├── operators/
    ├── first_operator.py

In the __init__.py do this:

import bpy

from .operators.first_operator import FirstOperator

bl_info = {
    "name": "MyAddon",
    "description": "A demo addon",
    "author": "myname",
    "version": (1, 0, 0),
    "blender": (2, 7, 9),
    "wiki_url": "my github url here",
    "tracker_url": "my github url here/issues",
    "category": "Animation"

def register():

def unregister():

In the operators/first_operator.py file, do this:

import bpy

class FirstOperator(bpy.types.Operator):
    bl_label = "First Operator"
    bl_idname = "myaddon.first_operator"
    bl_description = "A demo operator"

    def execute(self, context):
        print("hello world")

        return {"FINISHED"}

You'll have to install the addon to use it. You can't just run the __init__.py from the text editor in Blender to make it work.

  • $\begingroup$ Perhaps also explain that the chosen myaddon name is where you can import using absolute imports. $\endgroup$
    – J. Bakker
    Apr 9 '18 at 12:37
  • $\begingroup$ Is there a way to refresh the installed add on if I changed something to it? $\endgroup$
    – sajdnv
    Apr 9 '18 at 14:08
  • $\begingroup$ Try the "Refresh" button in the user preferences window. I typically just restart Blender when I'm working on an addon. $\endgroup$
    – doakey3
    Apr 9 '18 at 14:09
  • $\begingroup$ is this still the same as of 2.8+ right now? $\endgroup$
    – adrian li
    Apr 5 '20 at 14:44
  • $\begingroup$ this doesnot work for 2.92 $\endgroup$ Apr 8 at 9:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.