OSArch Community

[Python] How is it possible to use colon to declare an variable?!

  1. M
  2. T
  3. C
  4. G

    This is indeed a python annotation.

    In the context of Blender's python API it is used to dynamically populate the operator instances that are crated at runtime when you click on an operator's button. You can then access these properties as standard members of the operator instance.

    In order for the API to recognize them you have to declare them as annotations. Otherwise they're just plan old python attributes of the main operator class (except the few attributes beginning with bl_).

Login or Register to reply.