Nope this wouldn't work:

pm.ls(type='camera')[0].pm.getParent().pm.getTranslation().z


Instead you'd need:

pm.ls(type='camera')[0].getParent()..getTranslation().z


Its only the initial function that gets prefixed with the module namespace.

On Monday, March 23, 2015 at 12:59:00 PM UTC-5, Simon Davies wrote:
>
> Hi all,
>
> I understand that if I import pyMel into Maya like this:
>
> from pymel.core import *
>
> I can then build up pyMel functions like this:
>
> ls(type='camera')[0].getParent().getTranslation().z
>
>
> However if I import pyMel with a name space instead:
>
> import pymel.core as pm
>
> Would the pyMel methods above all need prefixing with pm like this?
>
> pm.ls(type='camera')[0].pm.getParent().pm.getTranslation().z
>
>
> The above code doesn't work, so how should it be written if I import pymel 
> as pm?
>
> Thanks a lot.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to python_inside_maya+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/c4f4b6ff-427c-462a-a31f-d4be95354cf2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to