I have many files containing different parts of my blender internal material collection. How can I make a script which imports all of them into another blend file?
import bpy # using a relative path path = "//file_name.blend" with bpy.data.libraries.load(path) as (data_from, data_to): data_to.materials = data_from.materials
As a sanity check or for logging purposes, you can loop through what was appended and see if everything is there as it should be
for mat in data_to.materials: if mat is not None: print(mat.name)
As it relates to many files, it should be simple enough to extend the script to also loop through a list of filenames to append materials from. A final note, the materials appended have no users so make sure to stick them somewhere before closing your file.