People, what I want is to create own materials to each object so that when modifying some property of the material, it does not do it in more than one object. What happens is that all the materials created assign them to only one object, the first to be created, and I do not understand why. Annex code in python to be executed from blender for more clarity. I await an answer and thank you very much.
Another solution could be to create an object with a single material and duplicate it so that everyone has material, but when I modify a property of the material as I could unlink them so that it does not modify it in all the objects but only one in specific.
import bpy
bpy.ops.mesh.primitive_uv_sphere_add(size=1, location=(-1,-2,0))
nombre = "C1"
bpy.context.object.name = nombre
objetoActivo = bpy.context.active_object
mat = bpy.data.materials.new(name ='material')
objetoActivo.data.materials.append(mat)
bpy.ops.mesh.primitive_uv_sphere_add(size=1, location=(1,2,0))
nombre = "C2"
bpy.context.object.name = nombre
mat = bpy.data.materials.new(name ='material1')
objetoActivo.data.materials.append(mat)