BL 3.4.1 call operator

i followed the BL 3.4 API example

with a simple oeperator
with invoke and execute function

and call it
but it does not do the execute or invoke function

is this a bug or what is missing to make it work

see exampel here

call-operator-1.blend (122.1 KB)

happy bl

can you post your code as well? I mostly browse BA on my phone so I can’t load a .blend :slight_smile:

first: python is case sensitive.
second: your forgot the parenthesis

so the right call is


you wrote:


had to correct my Text editor to set the Case sensitive.

now i also change the operator class name with the OT

now it runs it no error
but still does not do the operator execute section

call-operator-2.blend (128.5 KB)

here is code

i cannot get to do the operator execute part
which should be done when you call it

import bpy,bmesh
import mathutils
from math import *
from bpy.props import *
from bpy.types import Operator


bl_info = {
	"name": "Call Operator from console",
	"category": "Object",


class Simple_OT_operator(bpy.types.Operator):

	bl_idname = "object.simple_operator"
	bl_label = "Tool Name"

	def execute(self, context):
		print("Hello World")
		return {'FINISHED'}


class MyAddon_OT_Operator(bpy.types.Operator):

	bl_idname = "object.myaddonoperator"
	bl_label = "My Addon"
	bl_options = {'REGISTER'}

	def poll(self, context):
		return context.mode == 'OBJECT'

	def execute(self, context):
		print (' excecute in operator  MyAddon_OT_Operator '   )
		return self.invoke(context, None)    

	def invoke(self, context, event):
		print (' invoke in operator  MyAddon_OT_Operator '   )

		return {'FINISHED'}

#   Now the addon can be called with 


def register(): 

	bpy.utils.register_class(  MyAddon_OT_Operator )
	bpy.utils.register_class( Simple_OT_operator )

def unregister():

	bpy.utils.unregister_class(  MyAddon_OT_Operator )
	bpy.utils.unregister_class( Simple_OT_operator )

if __name__ == "__main__":

thanks for feedback
happy bl

Invoke comes before execute. It is used so you can tweak the properties of an operator before it executes.

also i think you need to call the operator using the BL_idname

but still not working

can you elaborate on that invoke thing!

happy bl