Can not add reference to prim path by python

I am trying to add reference to prim by following code:

      omni.kit.commands.execute('CreateReference',
                              path_to=XformPrim_path,
                              asset_path=self._usd_file_path,
                              usd_context=omni.usd.get_context())

But I got following Warning, and can not see the reference in stage?

[Warning] [omni.usd] Warning: in _ReportErrors at line 2830 of /buildAgent/work/ca6c508eae419cf8/USD/pxr/usd/usd/stage.cpp – Could not open asset @~/Documents/Prj/omni-bookshelf-generator-main/exts/maticodes.generator.bookshelf/data/book_A.usd@ for reference on prim @anon:0x7f7f90000ea0:World7.usd@,@anon:0x7f7f900021c0:World7-session.usda@</World_02>. (recomposing stage on stage @anon:0x7f7f90000ea0:World7.usd@ <0x165d7b30>)

Hi @liuyuanyuan.sh. That command looks correct. Not sure if this is the issue, but could you try using an absolute path to the book_A.usd? Also, can you open the book as a Stage like using File->Open?

Hi @mati-nvidia

I solved this problem by changing the path to file:/“absolute path”.

Thank you. ^_^

Cool. Relative paths should work too. I think the problems was the ~ alias for home dir.