code: def load_file(self, filepath, chname=None, wait=True,
                    create_channel=True, display_image=True,
                    image_loader=None):
          if not chname:
              channel = self.get_current_channel()
          else:
              if not self.has_channel(chname) and create_channel:
                  self.gui_call(self.add_channel, chname)
              channel = self.get_channel(chname)
          chname = channel.name
          if image_loader is None:
              image_loader = self.load_image
          cache_dir = self.settings.get('download_folder', self.tmpdir)
          info = iohelper.get_fileinfo(filepath, cache_dir=cache_dir)
          if not info.ondisk:
              errmsg = "File must be locally loadable: %s" % (filepath)
              self.gui_do(self.show_error, errmsg)
              return
          filepath = info.filepath
          kwargs = {}
          idx = None
          if info.numhdu is not None:
              kwargs['idx'] = info.numhdu
          try:
              image = image_loader(filepath, **kwargs)
          except Exception as e:
              errmsg = "Failed to load '%s': %s" % (filepath, str(e))
              self.gui_do(self.show_error, errmsg)
              return
          future = Future.Future()
          future.freeze(image_loader, filepath, **kwargs)
          image.set(loader=image_loader, image_future=future)
          if image.get('path', None) is None:
              image.set(path=filepath)
          name = image.get('name', None)
          if name is None:
              name = iohelper.name_image_from_path(filepath, idx=idx)
              image.set(name=name)
          if display_image:
              if wait:
                  self.gui_call(self.add_image, name, image, chname=chname)
              else:
                  self.gui_do(self.add_image, name, image, chname=chname)
          else:
              self.gui_do(self.bulk_add_image, name, image, chname)
          return image