code: def import_assets(
      package_name,
      json_dirname,
      props,
      maps,
      do_tiles,
      tile_size,
      batch_size,
  ):
      """Same commandlet is used for importing assets and also maps."""
      commandlet_name = "ImportAssets"
  
      if do_tiles:
          for umap in maps:
              # import groups of tiles to prevent unreal from using too much memory
              map_template = {}
              for key, value in iter(umap.items()):
                  if key is not "tiles":
                      map_template[key] = value
              map_template["tiles"] = []
              tiles = umap["tiles"]
              tiles.sort()
              total_tiles = len(tiles)
              num_batches = int(total_tiles / batch_size)
              current_tile = 0
              current_batch = 0
              current_batch_size = 0
              current_batch_map = copy.deepcopy(map_template)
              # get groups of tiles
              while current_tile < total_tiles:
                  current_batch_map["tiles"].append(tiles[current_tile])
                  file_path = os.path.join(
                      json_dirname, tiles[current_tile]
                  )
                  current_batch_size += (
                      os.path.getsize(file_path) / 1000000.0
                  )
                  current_tile += 1
                  current_batch += 1
                  # import when the size of the group of tiles surpasses the specified size in MB
                  if current_batch_size >= batch_size:
                      import_setting_file = (
                          generate_import_setting_file(
                              package_name,
                              json_dirname,
                              props,
                              [current_batch_map],
                              do_tiles,
                              tile_size,
                          )
                      )
                      commandlet_arguments = [
                          '-importSettings="%s"' % import_setting_file,
                          "-nosourcecontrol",
                          "-replaceexisting",
                      ]
                      invoke_commandlet(
                          commandlet_name, commandlet_arguments
                      )
                      os.remove(import_setting_file)
                      current_batch_map = copy.deepcopy(map_template)
                      current_batch = 0
                      current_batch_size = 0
              # import remaining tiles
              if current_batch > 0:
                  import_setting_file = generate_import_setting_file(
                      package_name,
                      json_dirname,
                      props,
                      [current_batch_map],
                      do_tiles,
                      tile_size,
                  )
                  commandlet_arguments = [
                      '-importSettings="%s"' % import_setting_file,
                      "-nosourcecontrol",
                      "-replaceexisting",
                  ]
                  invoke_commandlet(
                      commandlet_name, commandlet_arguments
                  )
                  os.remove(import_setting_file)
      else:
          # Import Props
          import_setting_file = generate_import_setting_file(
              package_name,
              json_dirname,
              props,
              maps,
              do_tiles,
              tile_size,
          )
          commandlet_arguments = [
              '-importSettings="%s"' % import_setting_file,
              "-nosourcecontrol",
              "-replaceexisting",
          ]
          invoke_commandlet(commandlet_name, commandlet_arguments)
          os.remove(import_setting_file)
  
      # Move maps XODR files if any
      for umap in maps:
          # Make sure XODR info is full and the file exists
          if (
              "xodr" in umap
              and umap["xodr"]
              and os.path.isfile(
                  os.path.join(json_dirname, umap["xodr"])
              )
          ):
              # Make sure the `.xodr` file have the same name than the `.umap`
              xodr_path = os.path.abspath(
                  os.path.join(json_dirname, umap["xodr"])
              )
              umap_name = umap["name"]
              xodr_name = ".".join([umap_name, "xodr"])
  
              xodr_folder_destin = os.path.join(
                  CARLA_ROOT_PATH,
                  "Unreal",
                  "CarlaUE4",
                  "Content",
                  package_name,
                  "Maps",
                  umap_name,
                  "OpenDrive",
              )
  
              if not os.path.exists(xodr_folder_destin):
                  os.makedirs(xodr_folder_destin)
  
              xodr_path_destin = os.path.join(
                  xodr_folder_destin, xodr_name
              )
  
              print(
                  'Copying "'
                  + xodr_path
                  + '" to "'
                  + xodr_path_destin
                  + '"'
              )
              shutil.copy2(xodr_path, xodr_path_destin)
  
      # Create package file
      generate_package_file(package_name, props, maps)
  
imports: from __future__ import print_function
  import errno
  import fnmatch
  import glob
  import json
  import os
  import shutil
  import subprocess
  import sys
  import argparse
  import threading
  import copy
  import carla
label_desc: Use image node_id 9 for calling a global function with example usage: import_assets(package_name, json_dirname, props, maps, do_tiles, tile_size, batch_size) without return types