Multiple menus

(BigEfrom84) #1

The following code is supposed to create a panel with multiple menus. I am having trouble with the second one

class BasicMenu2 (bpy.types.Menu):
    bl_idname = "OBJECT_MT_select_test2"
    bl_label = "Select"

    def draw(self, context):
        layout = self.layout
        global group,groupName,numPSFiles
        
        for i in range(numPSFiles):
            if PSFiles[i].group == group and PSFiles[i].type == 2:
                layout.operator("wm.hello_world2", text=PSFiles[i].name)

The operator for this class is:

class HelloWorldOperator2 (bpy.types.Operator):
    bl_idname = "wm.hello_world2"
    bl_label = "Print Values Operator2"
    
    @classmethod
    def execute(self, context):
        return {'FINISHED'}

I get the following error:

TypeError: expected Operator, HelloWorldOperator2 class “execute” attribute to be a function, not a method

What does this mean??

0 Likes

(BigEfrom84) #2

its the @classmethod line. FIXED

0 Likes

(RickyBlender) #3

multi menu interesting
how does it works ?

thanks
happy bl

0 Likes