So I’m attempting to use PyMel to write a layout, however, I keep running into this issue. When I use:
import pymel as pm
and then try to run anything with pm it fails. For example:
pm.sphere()
# Error: 'module' object has no attribute 'sphere'
# Traceback (most recent call last):
# File "<maya console>", line 1, in <module>
# AttributeError: 'module' object has no attribute 'sphere' #
or:
testWindow = pm.window()
testWindow.setTitle('Carlos Mencia')
pm.menuBarLayout()
pm.menu(label='Test')
pm.menuItem(label='Things')
pm.columnLayout('testColumn', adjustableColumn=0, rowSpacing=5, parent=testWindow)
pm.button(label='Stuff')
pm.textScrollList('testScrollList', allowMultiSelection=1, height=145, width=250, e=1, ra=1, parent=testWindow)
pm.showWindow(testWindow)
I’m using the newest version of PyMel in 2011 and I’ve tried it in 2012 with the stock PyMel and I get the same thing. (I was watching south park and carlos mencia was on it so that’s why I named my window it. Plus I get to delete it, which is great. :D: )
I’ve tried it with import pymel.core as pm and it works fine, but I’m curious as to why it’s not working because it seems like there’s an obvious issue. Thanks!
—Edit—
Ok. Ignore this. Thanks to Seth (djTomServo) he pointed out that I should be using import pymel.core or import pymel.all.