I got this error message when I try to enable my addon.
dataBrush = bpy.context.blend_data.brushes AttributeError:'_RestrictContext' object has no attribute 'blend_data'
Please some help
I am working on an dynamic palette for sculpt brushes
Blender Stack Exchange is a question and answer site for people who use Blender to create 3D graphics, animations, or games. It only takes a minute to sign up.Sign up to join this community
Short answer: don't access blendfile data when an add-on loads.
This is an intentional limitation with add-on loading which was added because it caused so many errors with inexperienced developers not properly understanding how data should be accessed, in practice it's almost never what you really want, and if for some obscure reason it is, you better not do it in an add-on (just run a script directly).
The kind of bug this caused was:
scene = bpy.context.scene
Enabling an add-on should always give the same results no matter what Blend file you have open.
Instead, your tools should read from the context when they are activated by the user.