For example I load 2 images (with suffixes: _normal and _color) into Blender. I'm using this code for importing images:
supported_file_types = '.png', '.jpg', '.tif', '.hdr', '.bmp', '.dds', '.psd'
def path_iterator(path_name):
for fp in os.listdir(path_name):
if fp.endswith(supported_file_types) and ((bpy.context.scene.color_string) in fp[-10:]) or ((bpy.context.scene.normal_map_string) in fp[-10:]) or ((bpy.context.scene.height_map_string) in fp[-10:]) or ((bpy.context.scene.metallic_map_string) in fp[-12:]) or ((bpy.context.scene.rough_string) in fp[-15:]):
yield fp
Then I have those images in Image Editor.
How to find imported image by its suffix and assign to Image Node? I can't use the exact name of those textures just suffix, so this method won't work:
image_node.image = bpy.data.images['YOUR_IMAGE_NAME']