Getting the current file path in an extension

I am writing an Isaac Sim extension in python and I need to know the current project folder or the path to the usd that is currently open in Isaac Sim. I could not find any function for this in the API. Does anyone have an idea how to get the current file path from within a python extension?

i believe you could try the following:

import omni.usd
from pxr import Usd, Sdf

stage = omni.usd.get_context().get_stage()
print (stage.GetRootLayer().identifier)

That works! Thank you very much!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.