Theoretically I believe this should work
https://openusd.org/dev/user_guides/collections_and_patterns.html#configuring-pattern-based-collections [openusd.org]
collectionPrim = stage.DefinePrim("/CollectionPrim") myCollection = Usd.CollectionAPI.Apply(collectionPrim, "myCollection") myCollection.CreateExpansionRuleAttr(Usd.Tokens.expandPrims) pathExp = Sdf.PathExpression("/World/Light*{hasAPI:LightAPI}") expressionAttr = myCollection.CreateMembershipExpressionAttr(pathExp)
But the Sdf object doesn't have CreateExpansionRuleAttr() or PathExpression(). It might be a usd version thing but that's as far I got for now