I'm trying to change a lot of a brush's properties with the click of one button, like the smoothing, simplify, etc.

A command like bpy.data.brushes["Ink Pen"].tool_settings.gpencil_paint.brush.gpencil_settings.pen_smooth_factor = 0.5 should work, but when I run it, I get the following error:

Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
AttributeError: 'Brush' object has no attribute 'tool_settings'

It seems that every property I want to change on ANY gp brush that has the .tool_settings... in the property name simply does not work, and always returns this error. Pasting the exact lines that show up in the Info window into the console, still gets the error.


1 Answer 1


The python tooltip and the statement that's printed in the info console are misleading in this case. You should use directly :

bpy.data.brushes["Ink Pen"].gpencil_settings.pen_smooth_factor = 0.5

Let's reverse-enginner how to solve this. In the Python docs search for pen_smooth_factor.

The first result brings us to bpy.types.BrushGpencilSettings.pen_smooth_factor

If you scroll all the way down to the bottom of the page you'll see in References that this is implemented in bpy.types.Brush.gpencil_settings.

bpy.types.Brush is the type you get with bpy.data.brushes["Ink Pen"].

print(type(bpy.data.brushes["Ink Pen"]))

... truncated<class 'bpy.types.Brush'>


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .