change layers in runtime

can we change layers in runtime using python script.

There’s no notion of layers in the BGE, only active and inactive objects. When the game starts, all objects in the currently selected layers are considered active. Everything else is inactive, and active copies of them can be made by using the Edit Object actuator in Add Object mode or the addObject Python method.

If you want to have more complex object layouts that are already setup and you can switch between, you should use scenes.

Exactly,
IMHO, layers are basically to help you organize your work and maybe focus on one part of a level/map/set of objects, so the don’t “exist” -so to speak- in the BGE as Mobious stated. You can also add all objects from python and put them in the desired position/orientation in the level You can group your objects or parent them to a single object. Spawning the last will add the otheres(children)! If manual labor is preferred, then use scenes just like Mob says!