how import .blend?

i use LibLoad (exist other way?)

i have 2 blend in the same folders

from demoPlayer.blend i have this script:

import bge
def player(cn):
    if cn.sensors["Mouse"].positive:
        if 'explosion.blend' not in bge.logic.LibList():
            bge.logic.LibLoad('explosion.blend', 'Scene')

but say Value Error: could not opend blendfile “explosion.blend”

whats is wrong?

this make the same error: (triggering by a sensor brick)

import bge
bge.logic.LibLoad('explosion.blend', 'Scene')

this is a simple demo with 2 file …(clean the last extension .blend)


demoLibLoad.rar.blend (114 KB)

Excuse me for my lack at script experience, but I try to follow and maybe even help by making dumb comments. :wink:

    if 'explosion.blend' <b><i>not</i></b> in bge.logic.LibList():             bge.logic.LibLoad('explosion.blend', 'Scene')

You check if it isn’t in bge.logic.LibList, then to send it to bge.logic.LibLoad,… right?
Then the file doesn’t seem to be available at the location it is looking?
(Either location, or the name incorrect, or the parameter “Scene” is not available (miss spelled)?)

But I guess you already tried to walk over these a couple of times… :slight_smile:

I did a “copy and paste” from another script.

“I believe” that libList is a list of imported blend (so if can import “explosion.blend” should be add “explosion.blend”)

now is :

import bge


>>> []


with a new blend is empty

the path,on default should be the same of the actual blend (so should be right) .

PS: try one moment to change those name

nah, the name is correct

import bge

#“explosion.blend”, “playerDemo.blend”

bge.logic.LibLoad(“explosion.blend”, “Scene”)

Value Error…

Try providing full path as the first argument to LibLoad()

bge.logic.LibLoad(“C:/folder/explosion.blend”, “Scene”)
#explosion.blend is in a folder named ‘folder’ in C drive

If it is a list of imported blends, and you check if it isn’t on this list,…
then if it isn’t on there (because it isn’t loaded yet), then you need to load it (/add to it to that list).

? Just trying to help ? :slight_smile:


i need to add “//” to the blend to import and work ("//explosion.blend",“Scene”)

now must import the obj from the LibList() i think , as say Crumpet :wink:


GOod. Wuhuu :slight_smile: