Ok well it's a little more complicated because the objects are the same, if they were different it would be a simple set object B var to objectA.var.
Here are two ways I tried using a function to set the var or by setting it 'on object created' with a global variable.
Note the second way has an extra variable spawnnew because if you don't have this it will also assign the variable to the blocks created on start of layout and you probably don't want this.