Aha, you are trying to find the path to the referenced file? In that case, Maya maintains each reference in a node of type “reference”. You can then query various properties of this node, including the full path to the file it references.
for reference in cmds.ls(type="reference"): fname = cmds.referenceQuery(reference, filename=True) print(fname) On Wed, 15 Nov 2023 at 03:07, Juan Moraga <juanmoragamar...@gmail.com> wrote: > what about: cmds.file(q=True, l=True)[0]? > > On Tue, 14 Nov 2023, 23:09 Utkarsh Agnihotri, <utkarsh6...@gmail.com> > wrote: > >> I have a scene with referenced rig e.g. walk.ma. I am trying query the >> scene name so that I can export a fbx with same name. How ever, scenes with >> references are not returning anything. >> >> On Tue 14. Nov 2023 at 23:11, Marcus Ottosson <konstrukt...@gmail.com> >> wrote: >> >>> That definitely should work, independent of references. How can I >>> reproduce what you see? >>> >>> Here’s what I see: >>> >>> from maya import cmds >>> # Make an original scene to reference >>> cmds.polyCube() >>> cmds.file(rename="referenceMe.ma") >>> cmds.file(save=True, type="mayaAscii") >>> # Make a new scene, and reference the original scene >>> cmds.file(new=True, force=True) >>> cmds.file("referenceMe.ma", reference=True) >>> cmds.file(rename="newScene.ma") >>> >>> fname = cmds.file(query=True, sceneName=True)assert >>> fname.endswith("newScene.ma") >>> >>> >>> On Tue, 14 Nov 2023 at 16:50, Utkarsh Agnihotri <utkarsh6...@gmail.com> >>> wrote: >>> >>>> Hi, >>>> >>>> I am trying to query Maya scene name and path using >>>> >>>> main_scene_file = cmds.file(q=True, sceneName=True) >>>> >>>> But it doesn't work when there are references in the scene. Does anyone >>>> how can I fix that? >>>> >>>> Thanks :) >>>> >>>> -- >>>> 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/f11a3271-498a-4857-8a8b-a12e171086e4n%40googlegroups.com >>>> <https://groups.google.com/d/msgid/python_inside_maya/f11a3271-498a-4857-8a8b-a12e171086e4n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >>> You received this message because you are subscribed to a topic in the >>> Google Groups "Python Programming for Autodesk Maya" group. >>> To unsubscribe from this topic, visit >>> https://groups.google.com/d/topic/python_inside_maya/_avaEPrznr4/unsubscribe >>> . >>> To unsubscribe from this group and all its topics, 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/CAFRtmODh9pD7iuHHbUG3EfX8VV3ukO-k-R97LqkNSqYNDCFOfA%40mail.gmail.com >>> <https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODh9pD7iuHHbUG3EfX8VV3ukO-k-R97LqkNSqYNDCFOfA%40mail.gmail.com?utm_medium=email&utm_source=footer> >>> . >>> >> -- >> 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/CAPCRbh-JZ5OABbSg7JMF06MAmCPOC7eubsbKSi4EROjbABMtjQ%40mail.gmail.com >> <https://groups.google.com/d/msgid/python_inside_maya/CAPCRbh-JZ5OABbSg7JMF06MAmCPOC7eubsbKSi4EROjbABMtjQ%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> > -- > 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/CA%2BKy2f2_x4yjKwQ3%2Bs6-e%3DowyuGGQBMAqiUAxjPBf-GQanazfg%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CA%2BKy2f2_x4yjKwQ3%2Bs6-e%3DowyuGGQBMAqiUAxjPBf-GQanazfg%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > -- 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/CAFRtmOCWLTztEodUXwwTL2%3DCrFUNa6p3dZYPNvRPVRiyKFHNSA%40mail.gmail.com.