def pick_two_obj_then_place(self, objecttype, receptacletype):
    def pick_two_obj_then_place():
        # we need to pick two objects and place them in the receptacle, so here we define a recursive function
        if self.name2type(self.holding) != self.name2type(objecttype):
            # Find the object
            entity = self.find_object(objecttype)
            if entity is None:
                # Find receptacletypes that can contain the object
                r_types = self.find_canbe_contained(objecttype)
                if r_types is None:
                    # Explore the environment
                    self.explore()
                    return
                else:
                    # Check each receptacletype to find the object
                    for r_type in r_types:
                        r_entitys = self.find_receptacles(r_type)
                        if r_entitys is None:
                            continue
                        for r_entity in r_entitys:
                            self.goto(r_entity.name)
                            if r_entity.openable and not r_entity.isopen:
                                self.open_receptacle(r_entity.name)
                                return
            else:
                # Go to the receptacle and place the object
                if hasattr(self, "old_object_name") and self.old_object_name == entity.name:
                    # hasattr means that we have placed one object before, so we need to place another
                    object_entitys = self.find_objects(objecttype)
                    if len(object_entitys) == 1:
                        self.explore() # if there is only one object, then explore the environment to find more objects
                        return
                    else:
                        pick_two_obj_then_place() # if there are more than one object, then pick_two_obj_then_place again
                        return
                receptacle_entity = self.find_receptacle(receptacletype)
                if receptacle_entity is None:
                    # Explore the environment
                    self.explore()
                    return
                else:
                    self.goto(receptacle_entity.name)
                    self.put(entity.name, receptacle_entity.name)
                    setattr(self, "old_object_name", entity.name)
                    return
        else:
            # Find another object to place in the receptacle
            for object_entity in self.find_objects(objecttype):
                if object_entity.name != self.old_object_name:
                    receptacle_entity = self.find_receptacle(receptacletype)
                    if receptacle_entity is None:
                        # Explore the environment
                        self.explore()
                        return
                    else:
                        self.goto(receptacle_entity.name)
                        self.put(object_entity.name, receptacle_entity.name)
                        return
                
    pick_two_obj_then_place() # start the pick_two_obj_then_place process