Query Reference Items immediate after creation

Hi,
I'm trying to list all the objects of a USD reference immediately after reference creation. the code works if I run first and second part separately, but fails when I run all at once. Could you please let me know what am I missing..
First Part
Second Part
Thank you
I'm trying to list all the objects of a USD reference immediately after reference creation. the code works if I run first and second part separately, but fails when I run all at once. Could you please let me know what am I missing..
First Part
- Code: Select all
import ix
model_ctx = ix.application.get_current_context()
ref = ix.cmds.CreateFileReference(str(model_ctx), [r"X:\Testing\cubes.usd"])
Second Part
- Code: Select all
geom_objects = ix.api.OfObjectArray()
model_ctx.get_all_objects(geom_objects)
for obj in geom_objects:
print(obj)
Thank you