mesh.materials.find ( bpy_prop_collection )


i would like to get the index of a certain material with within a mesh’s materials

following the docs
mesh.materials is a bpy_prop_collection
and bpy_prop_collection has a find method

but i get the error

    materialIndex = self.mesh.materials.find[material]
TypeError: 'builtin_function_or_method' object is not subscriptable

looking closer at the docs it says

Note Note that bpy.types.bpy_prop_collection is not actually available from within blender, it only exists for the purpose of documentation.

i’m a bit confused
does this mean we can’t use the methods of bpy_prop_collection ?

i guess i can find the index of the material by looping through mesh.materials …

can anybody shed light on this ?


ok my bad
should be

materialIndex = self.mesh.materials.find(material) iso materialIndex = self.mesh.materials.find[material]:smiley: