Insert UI elements into existing layouts


#1

For example I would like to add an button to the shelf and I query the shelf with this:
import maya.cmds as cmds

a = cmds.layout(‘Shelf’, query = True, childArray = True)
b = cmds.layout(a, query = True, childArray = True)
c = cmds.layout(b, query = True, childArray = True)
d = cmds.layout(c[1], query = True, childArray = True)
e = cmds.layout(d[1], query = True, childArray = True)
print e

Its only an example! I would like to add a button by script between ‘shelfButton1’ and ‘shelfButton2’, the first and second element of ‘e’.
This is a shorter and easier to understand version of my actual problem.
Hope you can help!


#2

https://forums.autodesk.com/t5/maya-programming/bd-p/area-b50


#3

I already posted it there but got no answer so far and wanted to try it here, too