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'}
print(bpy.__file__)
to see if thebpy
module is actually loaded from where you expect. $\endgroup$