I'm trying to dock an attribute table on the left hand side of my window, above the Layers panel.
By enabling "Open new attribute tables as docked windows"
(under Settings Options > Data Sources > Feature attributes and table
and using code I adopted from Displaying QGIS attribute table on the right, I can do something like:
from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtWidgets import QApplication
# Display the attribute table (by default it appears at the bottom)
iface.showAttributeTable(some_layer)
# Find, and move attribute table to left hand dock widget area
attrTables = [d for d in QApplication.instance().allWidgets() if d.objectName() == u'AttributeTable']
iface.addDockWidget(Qt.LeftDockWidgetArea, attrTables[0])
However, the attribute table appears underneath the layers panel. How do I get it to appear above it?