I don't have a lot of knowledge of python, however some googling made me believe that the auto_load.py file was finding the sub modules in the directory and automatically loading them into blender for the addon. So logically, I took the basic tutorial found Here to move each object in the scene a bit and made a new file with the functional parts of the code. Alas, a log states that the file is not a module is_package = False. I've been googling around more, however I can't seem to find how to tell pkgutil that the file is actually a module. What exactly am I missing?
EDIT - It seems I slightly misunderstood what was happening and the module is being loaded, or at least it's claiming it has been. I added register() and unregister() to the module, however when i call bpy.utils.register_class(ObjectMoveX) I get an error stating already registered as a subclass. So instead, i just log Loading ObjectMoveX which does print, but the command does not show up in the command menu.
ObjectMoveX.py
import bpy as blenderpy
class ObjectMoveX(blenderpy.types.Operator):
"""My Object Moving Script"""
bl_idname = "object.move_x"
bl_label = "Move X by One"
bl_options = {"REGISTER", "UNDO"}
def execute(self, context):
scene = context.scene
for obj in scene.objects:
obj.location.x += 1.0
return {"FINISHED"}
def register():
print("Loading ObjectMoveX")
#blenderpy.utils.register_class(ObjectMoveX)
def unregister():
print("Unloading ObjectMoveX")
#blenderpy.utils.unregister_class(ObjectMoveX)
I don't have a lot of knowledge of python, however some googling made me believe that the auto_load.py file was finding the sub modules in the directory and automatically loading them into blender for the addon. So logically, I took the basic tutorial found Here to move each object in the scene a bit and made a new file with the functional parts of the code. Alas, a log states that the file is not a module
is_package = False
. I've been googling around more, however I can't seem to find how to tell pkgutil that the file is actually a module. What exactly am I missing?EDIT - It seems I slightly misunderstood what was happening and the module is being loaded, or at least it's claiming it has been. I added
register()
andunregister()
to the module, however when i callbpy.utils.register_class(ObjectMoveX)
I get an error statingalready registered as a subclass
. So instead, i just logLoading ObjectMoveX
which does print, but the command does not show up in the command menu.ObjectMoveX.py