How can I load a model into bge in real time from a blend file with python? In other words when the game is running.


1 Answer 1


By default the BGE loads everything from a scene at scene start. To add more objects to a scene while the game is running you can use bge.logic.LibLoad() to dynamically load all objects from a scene of an external .blend file.

Be aware currently (since 2.78) this is supported:

  • loading a single mesh (mesh - not object!)
  • loading all objects of a scene
  • loading an action

Sample code:

def loadAndMergeScene():
    libraryStatus = bge.logic.LibLoad(
    return libraryStatus.libraryName

To unload the merged data call LibFree(). The library name should match the one from loading.

def removeAndUnloadLibrary(libraryName):

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .