I'm using a program called Noesis to convert game map files to .obj files. The output gives me an .obj and .tga image files. After importing the .obj, I noticed that there are many materials in its index which have the same names as the .tga files. I have manually repeated this action to assign all image textures to the materials: Select Material #0-27> Select "Image Texture" in the "Base Color" option under "Surface" > Open the .tga
Is there a way to automate this process using loops?
I've been searching for answers and I found some similar questions, but my question isn't really getting answered in my search. I'm really interested in learning Python, and I thought this would be a great first project, but I need a little help to get me going.
I determined I need to do at least two things:
1. bpy.data.objects["The Sanctuaryof Zi'tah"].active_material_index = #
2. bpy.ops.image.open(filepath="C:\Users\\admin\\Desktop\\noesisv4423\\Zitah\\rt_w01c.tga", directory="C:\Users\\admin\\Desktop\\noesisv4423\\Zitah", files=[{"name":"model rt_w01c.tga", "name":"model rt_w01c.tga"}]
The index number identifies the material as a number in the order of the index, so how I do I get it to identify it by its set name, and then go into the folder the obj is located in to get the corresponding image texture?
EDIT 1:

When I select "Base Color" here and choose "Image Texture" before opening the file, an image texture node is created.

The Sanctuaryof Zi'tah.objand the texture is calledmodel rt_w01c.tga, I'd expect something likemodel_Sanctuaryof_rt_w01c.tga... so that's more like a "No". Basically we need any relation between them, name, date whatever to match geo and texture... Please enable the extensions in windows explorer and re-post the screenshot, pretty useless at the moment. We need to understand and figure a relationship before coding otherweise it's a waste of time, so again the easiest way is adding a obj and tga file... – brockmann Apr 16 '20 at 06:43