It looks like you're new here. If you want to get involved, click one of these buttons!
I am trying to code a simple script that detect what is the active layer in the menu
and use it to draw some polygon. (in this case it should be POLY1 )

I thought I can find something inside 'current_view()'
pya.Application.instance().main_window().current_view()
it seems I cannot find anything useful at this level
I tried to examine the content of
pya.Application.instance().main_window().current_view().begin_layers()
(with this simple script, that print some property of the layer, like : valid,.visible ...)
print("\n\nbegin_layers")
ap=pya.Application.instance().main_window().current_view().begin_layers()
while not ap.at_end() :
cur=ap.current()
print(cur)
print(cur.name,cur.valid,cur.visible)
ap.next()
Still nothing is telling what is the current active layer in the gui (may is there but I do not know how to access)
I also trying a "promising" LayerInfo(), pya.LayerInfo(), apparently intuition does not help.
I am on the wrong track...