code: def set_obj_list_element(obj, attr: str, value):
      r"""
      Set the element to value of a list object
  
      It used like set_obj_list_element(obj, 'layers[0]', new_layer), it will set obj.layers[0] to value
  
      Args:
          obj (object): The object to set
          attr (str): the string including a list index like `layers[0]`
      """
      re_pattern = r"\[\d+\]"
      prog = re.compile(re_pattern)
      result = prog.search(attr)
      if result:
          matched_brackets = result.group()
          matched_index = matched_brackets.replace("[", "")
          matched_index = matched_index.replace("]", "")
          attr_ = attr.replace(matched_brackets, "")
          container_obj = getattr(obj, attr_)
          container_obj[int(matched_index)] = value
      else:
          setattr(obj, attr, value)
  
imports: import re
label_desc: Use image node_id 2 for calling a global function with example usage: set_obj_list_element(obj, attr, value) without return types