How to get layers in x number of subgroups?
There is a handy option in the QgsLayerTreeGroup
class that you can use: findGroup
. It traverses the whole tree. So, in your case, this would be enough:
root = QgsProject.instance().layerTreeRoot()
subGroup1A = root.findGroup('Sub_Group_1A')
for child in subGroup1A.children():
if isinstance(child, QgsLayerTreeLayer):
child.layerName()