I have multiple scripts that i would like to turn into an addon. I already have everything it needs, but i when i click the button to enable the addon in the user preferences it says:

  ValueError: register_class(...): already registered as a subclass

I imported every other file I need via from .example import example and put these files in one folder. I even looked up other blender addons, but that didn't help either.


def register():
   bpy.types.Scene.Tree = bpy.props.StringProperty()
   bpy.types.Scene.Growth_limitation = bpy.props.BoolProperty()
   bpy.types.Scene.limiter = bpy.props.StringProperty()

def unregister():
   del bpy.types.Object.Tree
   del bpy.types.Object.Growth_limitation
   del bpy.types.Object.limiter


These are only the register and unregister functions. I noticed that my panels sitll shows up, even though the box is not ticked. When I try to execute my script it says, that it cannot perform a relative import.

  • 1
    $\begingroup$ From the information provided it is only possible to be certain that there is a problem with the code. If the answer does not satisfy you, you will need to share the code obviously. $\endgroup$ Sep 27, 2018 at 13:48
  • 1
    $\begingroup$ The error is pretty self explanatory you are trying to register an already registered blender class. Often this is due to not unregistering the class properly, noticeable particularly if you are testing enabling and disabling your addon. $\endgroup$
    – batFINGER
    Sep 27, 2018 at 13:55

1 Answer 1


Enabling an addon calls register

The issue in new code posted is the lack of

if __name__ == "__main__":

(pretty much ubiquitous in all blender addons and UI code etc etc, or for python command line scripts) Without this conditional register() will be run on import (Worth noting on import __name__ is the module name, ie not matching "__main__").

When an addon is enabled it is imported and calls its module.register() Henceforth your code is registering a second time and throws the error on the first class registered in register method.

The conditional code is there so scripts can be tested in the text editor.

Note: another thing to look for: for registered classes the bl_idname property is how they are known to blender.

  • $\begingroup$ Yes that worked. But now it says "cannot perform relative import" when i try to import a class form another script. $\endgroup$
    – Nebeig
    Sep 28, 2018 at 7:41
  • $\begingroup$ I could solve the problem. I named the main file init.py and put every python file i needed in a .zip folder. $\endgroup$
    – Nebeig
    Sep 29, 2018 at 9:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .