Changing property of an object on a hidden layer

So for my game I need a button on my UI to allow selection for my character to go to an object. I am using different states to do this. So I will have a state that allows you to click on the character and the button pops up (which is also across scenes in an overlay scene, which works just fine). I am using properties to switch states on my character. I have done this successfully before with a similar code on other objects. However the problem is that I am trying to do this to an object on a hidden layer. When I run the code, no errors pop up on the console, yet nothing happens either. It is apparent that the property hasn’t been altered at all. If someone could help that would be great. Thanks.

import bge
SMouseOver = "sMouseOver1"
SMouseLeft = "sMouseLeft1"

def characterResource(cont):
    #check for sensors
    sMouseOver = cont.sensors[SMouseOver]
    if not sMouseOver.positive:

    sMouseLeft = cont.sensors[SMouseLeft]
    if not sMouseLeft.positive:
    #set object to change property of : .objectInactive added to this version of the code
    obj = bge.logic.getSceneList()[0].objectsInactive['worker.b.dynamics'] 
    obj['UI'] = 1

I will try to upload the file later but I have been receiving errors. Thanks in advance for any help

Why not edit a property on a “spawner” and then have spawning the object on the hidden layer change the property?

Bob = own.addObject(Object,other,Time)

Bob[‘Property’] = own[‘PropertyStrored’]

Objects on hidden layer are inactive. So it is naturally that nothing happens.

BluePrintRandom, Maybe, and I think I understand what you are saying. However this needs to be controlled by a button/mouse click by the players will. If i understand you right (which I might not) that would instantly change the property when they are spawned in. Also, I realize i have been going about it the wrong way anyways. The property can very well still change… On the object in the hidden layer.

   Yes, I just checked and it does in fact change the property so when I spawn in a character AFTER I click the button, So the code works just fine for what I told it to do. Kinda like when you tell an object to track to another object in a hidden layer. It'll track to that spot because you told it to. So now I just need to find out how to update the current character...

Edit so it updates the object on the hidden layer instead of the selected player basically.

Ok, so with this new approach I have taken by just being able to click on a person, and change their state (This way I can do several other things too) But I realized that yes, I can individually "select each person, but they still all do the same thing, and go to the same places. This is because I realized that my code still continues to run, continuously updating each character with what I select for the latest characters actions. So is their a way to tell the script to stop when it has run the full script? that way it will no longer update the track to target? and if anyone is interested, the code is below.

import GameLogic

SMouseOverAny     = "sMouseOverAny"
SMouseLeft = "sMouseLeft"
ATrackTo    = "aTrackTo"

#check to make sure it is in fact a "resource"
def trackToResource(cont):
    sMouseOver = cont.sensors[SMouseOverAny]
    if "resource" not in sMouseOver.hitObject:

    #check for sensor activation
    if not sMouseOver.positive:

    sMouseLeft = cont.sensors[SMouseLeft]
    if not sMouseLeft.positive:

    #activate trackto actuator
    aTrackTo = cont.actuators[ATrackTo] = sMouseOver.hitObject