1
$\begingroup$

I have created an addon written in multiple files.

if "bpy" in locals():
    import importlib
    importlib.reload(operator_add)
else:
    from . import operator_add
    from . import operator_create


import bpy
import bmesh
import os
from operator_add import OBJECT_add

I got error message when trying to activate the add-on

AttributeError: module 'bpy' has no attribute 'props'

in the operator_add.py I have the class as follow:

class OBJECT_add(bpy.types.Operator):
    bl_idname = "myops.addthings"
    bl_label = "Add Base Mesh"
    bl_options = {'REGISTER', 'UNDO'}
    bl_description ="Add Base Mesh"
    #the error comes from this line:
    objectsToAdd = bpy.props.StringProperty()
    #this is trying to get the property from the UI draw() in the __init__.py

    def execute(self, context):
        add_myobject(self, context)
        return {'FINISHED'}
$\endgroup$
0
$\begingroup$

https://github.com/JacquesLucke/code_autocomplete

Here is a blender add-on that lets you create multi-file add-ons in blender easily. Just download the repository .zip and install the add-on. Next enable it. Now in the text editor click view > properties You will now see a couple new panels one named Addon Development then you will see a text box. Simply type in the name of your new add-on and click the button that pops up that says new addon multi-file Once this is done it will create a multi-file add-on automatically for you. Remember to click save all filesoften and also when you load blender back up and want to work on your add-on again just click the eyedrop tool and you will see a list of all the add-ons you are currently working on and click the one to load and it will. Hope this helps :)

Also in operator_add.py do you have import bpy? Maybe thats the reason?

$\endgroup$

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.