Blender Python: Generate custom property (due to error bpy_struct[key]: key "PropertyName" not found)?
When a custom property is accessed as obj["custom_prop"], it will throw an error in the console ('bpy_struct[key]: key "PropertyName" not found') if that property has not been assigned yet. To fix this, you can instead use obj.get("custom_prop", DEFAULT_VALUE). This will not throw an error, and will return the default value if the property doesn't yet exist.

I'm assuming we should ALWAYS use the syntax obj.get("custom_prop", DEFAULT_VALUE) instead of obj["custom_prop"]? Can anyone confirm this? Or at least in situations where we may be reading the value before writing to it.

I'm very new at this, so anyone feel free to chime in here.