this is to randomise material according a prefix name , so you can take a several materials starting with the same prefix and apply them randomly to several meshes.
how could I apply this script if each mesh use a different prefix. if I have 2 objects and I want to randomise 1 with a prefix and randomise the second one with another prefix in the same script.
I don't know anything about python
import random import bpy prefix = '_' materials =  for mat in bpy.data.materials: if mat.name.startswith(prefix): materials.append(mat) for obj in bpy.context.selected_objects: obj.active_material = random.choice(materials)
here is the python script on the youtube tutorial
If anyone has a solution , that ll be great 🙏