code: def internal_model_from_file(
              self, file_name, encoding='utf-8', debug=None,
              pre_ref_resolution_callback=None, is_main_model=True):
          
          model = None
          callback = pre_ref_resolution_callback
  
          if hasattr(self, "_tx_model_repository"):
              # metamodel has a global repo
              if not callback:
                  def _pre_ref_resolution_callback(other_model):
                      from textx.scoping import GlobalModelRepository
                      filename = other_model._tx_filename
                      assert filename
                      # print("METAMODEL PRE-CALLBACK{}".format(filename))
                      other_model._tx_model_repository = GlobalModelRepository(
                          self._tx_model_repository.all_models)
                      self._tx_model_repository.all_models\
                          .filename_to_model[filename] = other_model
  
                  callback = _pre_ref_resolution_callback
              if self._tx_model_repository.all_models.has_model(file_name):
                  model = self._tx_model_repository.all_models\
                      .filename_to_model[file_name]
  
          if not model:
              # model not present (from global repo) -> load it
              model = self._parser_blueprint.clone().get_model_from_file(
                  file_name, encoding, debug=debug,
                  pre_ref_resolution_callback=callback,
                  is_main_model=is_main_model)
  
          for p in self._model_processors:
              p(model, self)
          return model
docs: Instantiates model from the given file.
          :param pre_ref_resolution_callback: called before references are
                 resolved. This can be useful to manage models distributed
                 across files (scoping)