Scene children get undefined outside of loadAsync

After loading the gltf models to the scene, they become undefined when called outside of loadAsync. However, if you call them inside the promise, they are defined.
Also, if you do console.log(scene.children) outside of the promise, you see that all the children of the array are properly defined. However, once you do console.log(scene.children[0]) then it returns undefined again. All the models are still rendered, and can be raycasted.
Any idea why?

Here are my related codes:

const loadManager = new THREE.LoadingManager();
const loaderGLTF = new GLTFLoader(loadManager);
//Using promise to load models
const loadAsync = url => {
	return new Promise(resolve => {
	 loaderGLTF.load(url, gltf => {

Promise.all([loadAsync('./assets/visuals/digitalAnimation.glb'), loadAsync('./assets/visuals/background.glb')]).then(models => { 
	let blenderMixerIndex = 0; 
	for(let j =0; j<models.length; j++){
		if (models[j].animations.length > 0) {
		blenderMixer.push(new THREE.AnimationMixer( models[j].scene ));
		blenderActions1.push(blenderMixer[blenderMixerIndex].clipAction( models[j].animations[0]));
		if (models[j].animations.length > 1) {
			blenderActions2.push(blenderMixer[blenderMixerIndex].clipAction( models[j].animations[1]));
		if (models[j].animations.length > 2) {
			blenderActions3.push(blenderMixer[blenderMixerIndex].clipAction( models[j].animations[2]));
		if (models[j].animations.length > 3) {
			blenderActions4.push(blenderMixer[blenderMixerIndex].clipAction( models[j].animations[3]));
		blenderMixerIndex ++;
        scene.add( blenderModels[j] );   
    console.log(blenderModels[1]); //this returns a valid object
console.log(blenderModels[1]); //returns undefined object

Due because on behalf of based on the fact that that’s what Promises are.

These values don’t “become undefined” when you try to log their values outside of the promises - doesn’t matter if before the promise is created or after - they just aren’t defined yet, because synchronous code will execute before the asynchronous Promise is finished.

Additionally - keep in mind that when logging objects & arrays to devtools - you won’t always necessarily see the actual value at the time of logging. You’re console logging a reference, and the value is read only after you preview it in the console.