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.


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):

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.