Is it possible to share values in Collaboration using sendPython?

Is it possible to share values in Collaboration using sendPython?

chaaseLTH9X
Contributor Contributor
68 Views
1 Reply
Message 1 of 2

Is it possible to share values in Collaboration using sendPython?

chaaseLTH9X
Contributor
Contributor

I have a Collaboration session with custom scripts running on both sides.  I would like to be able to send parameter values back and forth between the VRED Pro 2026.1 instances.

 

I tried something like creating a list in one session:

global masterList

 

Then in the other session I created a command which should append an entry to that list:

myCmd = "masterList.append(5)"

vrSessionService.sendPython(myCmd)

 

But I just get this error:

Traceback (most recent call last):

File "<string>", line 1, in <module>

NameError: name 'masterList' is not defined

 

Any ideas to get this to work?  Or is there a better way?

 

-CH

0 Likes
Accepted solutions (1)
69 Views
1 Reply
Reply (1)
Message 2 of 2

chaaseLTH9X
Contributor
Contributor
Accepted solution

I found a work-around, but it is a bit rough:

1) Get a list of connected sessions: myCollabs= vrSessionService.getUsers()

2) Get the host: myHost = myCollabs[0]

3) Use myHost.sendPython(... in combination with mySet = vrVariantSets.createVariantSet(... to create a variant set on ONLY the host.

4) Use myHost.sendPython(... in combination with mySet.addScript(... to add script to the variant set which calls global masterList and then appends the desired entries to the list.  This is tricky to parse the string delimeters using ', \', \\', etc.  But it works!

4) Use vrVariantSets.deleteVariantSet(... to remove the variant set from the host.

 

All of this cleanly adds entries to the masterList on the host session.

 

If anyone thinks of a better way to do this, let me know!

 

-CH

0 Likes