Hi,
Sorry for “self-promoting” as my first post, but I thought maybe my recently-released open source library could be of some help to someone. It allows to work with Maya’s nodes and commands in an object-oriented way: https://github.com/chirieac/mayax
import mayax as mx
# retrieve object from scene
torus = mx.Node('pTorus1')
# create new node
cube = mx.cmd.polyCube()[0]
# connect nodes
torus['worldMatrix'].connect(cube['offsetParentMatrix'])
# set attribute value
cube.translate = mx.Vector(0, 5, 0)
# set attribute's properties
cube['translate'].locked = True
# add node reference as attribute
# (atttribute of type `message`, connected to `torus.message`)
cube.addAttr('parentDriver', torus)
# retrieve node reference
cube.parentDriver.worldPosition = mx.Vector(2, 5, 5)
If you find this useful, it will be great if you will let me know about that.