I've some operators that will appear like buttons in the UI. I want to give the user the possibility to add keyframe to the operators.

enter image description here

Looking in the documentation it doesn't seem to be possible. Is there an easy way to do it? Or can I try some workaround?

  • $\begingroup$ This sounds like the XY Problem. Operators are tools to change data they aren't animatable, unlike properties. They are functions you run instantaneously, you can't put keyframes on them. What are you trying to achieve? $\endgroup$ Sep 21, 2022 at 17:19
  • $\begingroup$ For example I have one operator that toggle viewport visibility for a group of item (mixed between objects and modifiers). I could use a simple Boolean Property but I can't figure out how to perform different operations if the user click on the property. $\endgroup$
    – Lucho
    Sep 21, 2022 at 17:28
  • $\begingroup$ Then you should probably be looking for a way to easily keyframe multiple different properties at wonce $\endgroup$ Sep 21, 2022 at 17:31

1 Answer 1


As pointed out by Duarte Farrajota Ramos it is not possible to animate operators. I solved using a BoolProperty in the UI instead of an operator. Thanks to the 'update' function we can then specify the operation we need to perform. Here is some example code.

class someClass(bpy.types.PropertyGroup):

   def viewport_toggle(self, context):
      #do what you want

   visibility : BoolProperty (default=True, update =viewport_toggle)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .