This may be another simple question but I can't seem to find a straight answer.
I am procedurally generating figures and as part of the last step I want to color the figure red.
If I manually add a new material to the figure I can change the color with bpy.context.object.active_material.diffuse_color = (1, 0, 0)
But I need to automate this step such that the program automatically add a new material and then changes the color. I've tried the following but it doesn't seem to work:
bpy.ops.material.new()
bpy.context.object.active_material.diffuse_color = (1, 0, 0)
It seems the problematic step is adding a new material. Any help would be greatly appreciated.