Just one other thing, is there a way to identify the total number of instances spawned for an object. If I can get the total number of IIDs, I can select the last one as the child and the penultimate one as the parent.
Every object has object.count function which returns number of specific object instances in the game. So carn.count returns total number of carn instances in the game.
You can use 'pick all' in system menu to pick every single instance of the object, then you could use 'pick nth' instance in system menu to pick object.count-1 to pick last (latest) instance of the object. Or which ever instance you desire.