How do I reference the bl_label inside operators? I want to know the name of the operator based on the bl_label to be precise.

  • $\begingroup$ Hi. I hope you don't mind my edit. If you meant something else please edit the question and correct it. $\endgroup$ – Martin Z Jan 3 at 8:37
  • $\begingroup$ @MartinZ it is a slippery slope to answer, and then edit question based on answer. Recommend asking, via comments, for clarification first. $\endgroup$ – batFINGER Jan 3 at 8:45
  • $\begingroup$ It wasn't formed clearly. I believe this was the intended question and encouraged yarun can to correct me if I am wrong. You might be right though. I will try to keep this in mind. $\endgroup$ – Martin Z Jan 3 at 8:55

You define bl_label inside the operator's code as a variable so after that you can reference it as any other variable inside the operator. It would be self.bl_label:

import bpy

class SimpleOperator(bpy.types.Operator):
    bl_idname = "object.simple_operator"
    bl_label = "Simple Object Operator"

    def poll(cls, context):
        return True

    def execute(self, context):
        return {'FINISHED'}

def register():

def unregister():

if __name__ == "__main__": 

    # test call

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.