Working with materials in python

I know how to add a material, and texture in python. I don’t know how to link them to each other, or how to assign them to an object.

Also, how do you access or set the file that an ‘IMAGE’ Texture uses

check out : Gyes by Kilon.

I dont know how you can assign a texture to a material. But a material can assign to an object like this bpy.context.object[“name of object”].data.materials.append([number or name of material])
creating new material can be done with either a or You can create new textures with but it unlike the same operator for materials it does not open a new slot and insert it in there, so you will have to create your slot yourself though i am not aware how you can assigne the slot to the texture.

if you want to find out how you insert the path to the image file do a dir(bpy.context.object[name of the object].active_material.texture_slots[number of texture slot]) and it will present with all available parameters and function you then consult the api doc what each parameter is for. Bare in mind that there is a diffirent set of parameter for a diffirent type of texture, so make sure you set bpy.context.object[name of the object].active_material.texture_slots[number of texture slot].type correctly . It should be in there.