The basic way to do something like this would be to have a global variable, set it on the first layout and check the value of this global variable on start of the second layout..
If the condition is true create object.. (or if the condition is false destroy object, whichever suits you best..