Things to try in Blender Console or add to scripts

Activate or de-activate 3D View layer

bpy.data.scenes['Scene'].layers[10] = True
bpy.data.scenes['Scene'].layers[0] = False