Skip to content

Instantly share code, notes, and snippets.

@alexgeek
Created September 5, 2019 19:57
Show Gist options
  • Select an option

  • Save alexgeek/e326645409a3e59da81b78ddaa645837 to your computer and use it in GitHub Desktop.

Select an option

Save alexgeek/e326645409a3e59da81b78ddaa645837 to your computer and use it in GitHub Desktop.
Link model collection in another file
import bpy
import os
rig_file = bpy.data.filepath
model_file = rig_file.replace('.Rig.', '.Model.')
if not os.path.exists(model_file):
raise Exception("Model file does not exist.")
if bpy.data.collections['Model'] is not None:
raise Exception("Model already linked.")
print("Linking model from '{}'.".format(model_file))
bpy.ops.wm.link(
directory=model_file + "/Collection/",
filename='Model',
link=True,
instance_collections=True,
autoselect=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment