0
$\begingroup$

I am trying to make a simple first add-on. I have installed it and made a keymap for it, but it doesn't seem to work. If I manually load the script in and run it, the keymap will start working and everything is great.

From what I can tell I think the add-on has been successfully installed but obviously something is going wrong and I just don't know what. Any help would be appreciated.

bl_info = {"name" : "GoodScript1",   "category": "3D View",   "author": "my name"}
import bpy


class WM_OT_dialogop(bpy.types.Operator):
    """Custom Operator - Add txt here """
    bl_label = "Add Cube"
    bl_idname = "wm.dialogop"
    
    
    def execute(self, context):
        
        bpy.ops.mesh.primitive_cube_add(size=2, enter_editmode=False, align='WORLD', location=(0, 0, 0), scale=(1, 1, 1))
        
        return {'FINISHED'}
    
    
def register():
    bpy.utils.register_class(WM_OT_dialogop)
    


def unregister():
    bpy.utils.unregister_class(WM_OT_dialogop)         
    
    
if __name__ == "__main__":
    register()
$\endgroup$
2
  • $\begingroup$ You need "blender": (2, 93, 0) (or whatever Blender version you want to target) in the bl_info. See eg this. $\endgroup$
    – scurest
    Commented Jun 24, 2021 at 14:48
  • $\begingroup$ @scurest Thank you! $\endgroup$ Commented Jun 24, 2021 at 14:56

0

You must log in to answer this question.

Browse other questions tagged .