I am using the GLTF loader to load a custom model in my scene.
I have a class Spaceship.js responsible for loading the model.
// Spaceship.js
import { GLTFLoader } from 'three/examples/jsm/loaders/GLTFLoader.js';
export default class Spaceship {
  constructor() {
    this.GLTFLoader = new GLTFLoader();
    this.loadModel(this.GLTFLoader, './spaceship_model.gltf').then(result => {
      this.model = result.scene;
    });
  }
  loadModel(loader, url) {
    return new Promise((resolve, reject) => {
      loader.load(
        url,
        gltf => {
          resolve(gltf);
        },
        undefined,
        error => {
          console.error('An error happened.', error);
          reject(error);
        }
      );
    });
  }
}
and a class ThreeShell.js acting as a shell for the whole three scene
import * as THREE from 'three';
import Spaceship from './Spaceship.js';
export default class ThreeShell {
  constructor(container = document.body) {
    this.container = container;
    this.setup();
  }
  setup() {
    ...
    this.spaceship = new Spaceship();
    console.log(this.spaceship);
    console.log(this.spaceship.model);
    ...
  }
}
Somehow, when logging this.spaceship I get an object with the model property.
But when logging this.spaceship.model, I get undefined.
I guess this might have to do with promises, which I am not comfortable with at the moment. That's why I am asking for your help.

 
     
    