can't read custom property from linked material using python I try to access my materials custom property's value using python. I use the following line of code to do that:

print(bpy.data.materials["MATERIAL NAME"]["CUSTOM PROPERTY NAME"])


what blender returns is this error:


  1.0
  Traceback (most recent call last):
    File "/PATH/TO/MY/SCRIPT/script.py", line XY, in 
  KeyError: 'bpy_struct[key]: key "INSTANCING" not found'
  Error: Python script fail, look in the console for now...


as you can see, before blender throws the error it actually logs my property's value. (1.0)

Since I am looping over all my scene's materials I did this to check if the Custom Property is existing:

hasattr(material, "CUSTOM PROPERTY NAME")


For whatever reason this is returning FALSE for all materials.

Does it have something to do with the fact that the materials I am aiming for are a linked from other .blend files maybe?

For me it's a dead end street for now, so any help would be much appreciated!
Unless defined as a bpy.props property hasattr won't work. . Use material.get("prop") or check if "prop" in material.keys()