getDagPath in Maya API 2.0?

Hi guys!
Could somebody help me?
I am trying to get the MDagPath in the API 2.0. My code in the old api is working fine:

def getMDagPath_old(name):
    dag = om.MDagPath()
    sel = om.MSelectionList()
    sel.add(name)
    sel.getDagPath(0, dag)
    return dag

But in the 2.0 is not working… its returning the name instead of the MDagPath Object:

def getMDagPath_new(name):
    sel = new_om.MSelectionList()
    sel.add(name)
    dag = sel.getDagPath(0)
    return dag

For sure its a very very beginner doubt, Im sorry and thanks for attention!

Both functions work for me. Maybe your import is wrong?
For api 2.0 it should be:

from maya.api import OpenMaya as new_om

thanks for replying @gonzalimator!
the code was working for me too, but I though it was not working, because in the new API, it was returning the name of the node, instead the Object, but I saw it is just a new way to represent this returning data. (at least as I understood) :slight_smile:

thank you very much!