How to know which layer is active in a certain 3d view I have couple of 3d views in my file, where all of them has layer 0 as the active layer and only one of them has layer 1 as the active layer. I wonder how I can check which layer is active in a 3d view, like in my case I want to know which 3dview has layer 1 active in it.

This is what I did so far:

import bpy

for area in bpy.context.screen.areas:
    if area.type == 'VIEW_3D':
        if area.spaces.active.layers_used[1] == True: # &lt;-- not working if other 3d views has layer 1 even if it's not active in this 3dview

            #do something


like the one shown below:
You should use the SpaceView3D.layers attribute.

layers_used is for the layers that have content (as shown by the dots)