Use python script to find objects in different layers of same scene?

For some reason let’s say I do:

bar = logic.getCurrentScene().objects['Bar']

… If ‘bar’ is in a different layer of the same scene, it says “key not in list”, in other words I think it can’t find it - I move ‘bar’ to the same scene, and what I want to do with it works because it can find it. How do I use python script to get an object ‘bar’, from the same scene, but on a different layer?

Does anyone experience this problem as well and know a way around it?

I think that objects on hidden layers are present, but inactive. So, you can get the inactive objects with:


It’s a list of inactive objects on different hidden layers of the same scene.

This works like a charm SolarLune!
bar = logic.getCurrentScene().objectsInactive[‘Bar’]