Import materials from another blend file: how to deal with name issues? I want to append a material from another blend file, but I have problems to get the appended materail:
#This works fine
with bpy.data.libraries.load(self.blendpath, link=False) as (data_from, data_to):
            data_to.materials = [&quot;myTestMaterial&quot;]
#This is the problem maker
mat = bpy.data.materials.get(&quot;myTestMaterial&quot;)

The problem is that the new material is named &quot;myTestMaterial001&quot; after I run the script for the secound time, is there a way to get the material object directly?
You did, but blender renamed it because the old imported data was still in this file, even if not used. You can get rid of unused data blocks in File -&gt; External Data -&gt; Clean Up -&gt; Purge, then try re-appending the material.