Manipulate a model after it's loaded

Hi.
I’ve loaded a dice model exported to .glb format from blender.

It imports but I’d like to know how to access it after it’s loaded.

import { GLTFLoader } from './three/examples/jsm/loaders/GLTFLoader.js';
const loader2 = new GLTFLoader();

//===================================================
// This works, imports the dice but that's it
//===================================================
loader2.load('../../models/D6.glb', ( gltf ) =>{
    scene.add( gltf.scene );
});


//===================================================
// This doesn't work, how do i acces what i loaded
//  outside of the loading function
//===================================================

let D_6 ;

loader2.load('../../models/D6.glb',
    (glb) =>{
       D_6 = glb;
});

console.log("outside " + D_6);
scene.add( D_6 );

How do i manipulate the object, and how di I retrieve it after the loader is done ?
Thanks !

This code does not work. The call of load() is asynchronous. So when D_6 = glb; is executed, the console logging and the addition to the scene was already done with undefined. Besides, it should be:

loader2.load('../../models/D6.glb', (gltf) =>{
       D_6 = gltf.scene;
});

You can only access D_6 in your code by checking for undefined. E.g.

if ( D_6 !== undefined ) console.log( D_6 );

Or you executed code that requires D_6 only when the loading process has finished.