# Set Freestyle line thickness using python script

I have enabled the freestyle SVG add-on. I can set the 'Line thickness' in the 'Render' tab. But, I would like to change this value using a python script. I can't find an example of this.

Does anyone know how to change the line thickness via script?

If you mouse over a field in blender it, amongst other things, gives you the script path

bpy.data.scenes["Scene"].render.line_thickness


For most scripts we use context. If we are in scene "Scene" it is the context scene, rather than look it up from bpy.data.scenes

import bpy
from bpy import context # for testing
scene = context.scene
#set line thickness to 2.0
scene.render.line_thickness = 2.0


Or in the python console, where C = bpy.context for convenience.

>>> C.scene.render.line_thickness
1.0

>>> C.scene.render.line_thickness = 3.0

• Stupidly, I never actually noticed that! (Ohps.) - Thankyou. – James Sep 5 '16 at 10:51