Linking an object from another blend-file in BGE

Hi guys,I was wondering if you know a way to have two different blend-files in which blend file 1 has the game model and the blend-file 2 has a pointer that when the BGE run-time starts the asset in blend file 1 will be in the blend-file 2.
(sorry for bad English).

  1. Put the object you want to link into a group.
  2. In the blend file you’ll be linking to, go to file–>link, then navigate to the group that you want to link. Click it to link it.

Here’s where I learned how:CG Master’s tutorial skip to about 20mins 20secs into the video and he talks about library linking.

Thank you doakey3 it works fine.

Is it possible to manage this with Python?

I would like to link and remove some object using Python.

Libload, to load in objects/blend files trough python.

Would you mind advising me how to add materials and shader nodes into loaded object?

I could load hammer object but it doesn’t have its material.
It always reports “Warning: mesh “Cube” has no vertices for material “MAGolden”. It introduces performance decrease for empty render.”

I’m sorry, i have no clue, i do not work with upbge 0.30.0 / bpy coding.

I only have code for appending objects/collections for UPBGE 0.3:

Append Object:

import bge
import bpy

scene = bge.logic.getCurrentScene()

blendfile = "untitled.blend"         # edit this (name of the blend file placed  in the same directoy)
abs_filepath = bpy.path.abspath("//" + blendfile)
blendfile = abs_filepath

section   = "\\Object\\"
filename    = "Cubelo"       # edit this  (name of the object)

directory = blendfile + section 
bpy.ops.wm.append(filename=filename, directory=directory) 
scene.convertBlenderObject(bpy.data.objects[filename])

Append Collection:

import bge
import bpy

scene = bge.logic.getCurrentScene()

blendfile = "untitled.blend"         # edit this (name of the blend file placed  in the same directoy)
abs_filepath = bpy.path.abspath("//" + blendfile)
blendfile = abs_filepath
section   = "\\Collection\\"
filename="Collection_lib"       # edit this (name of the collection)

directory = blendfile + section 
bpy.ops.wm.append(filename=filename, directory=directory) 
scene.convertBlenderCollection(bpy.data.collections[filename],True)