Calling a Python Operator from C

I am trying to call a python operator from the Compiled C code with:


I don’t know what to put in the WHAT_GOES_HERE. is it the bl_idname like “object.select_camera”. or is it the name of the Python Operator Class. I have tried both but after i compile blender and start it up i get this message in the console. search for unknown operator… Any Ideas?

>>> bpy.ops.object.select_camera.idname()

Try this:

WM_operator_name_call(C,"OBJECT_OT_select_camera", WM_OP_INVOKE_DEFAULT, NULL);

That is exactly what i needed thanks. I also found that i can set properties by passing in a PointerRNA in the last parameter. Here is the code i used. Thanks for the help CoDEmanX.

    PointerRNA ptr;
    WM_operator_properties_create(&ptr, "MVLIBRARY_OT_drag_and_drop");
    RNA_string_set(&ptr, "filepath", ima->name);
    WM_operator_name_call(C, "MVLIBRARY_OT_drag_and_drop", WM_OP_INVOKE_REGION_WIN, &ptr);