Connect a PythonScript to a BooleanSignal via code

Hey there! Im currently trying to create behaviours and properties via script in a component. One problem i stumbled upon right now is how to connect a vcBooleanSignal behaviour to a vcScript.

input = comp.findBehaviour("InputSignal")

connections = input.getProperty("Connections")
connections.Value = comp.findBehaviour("Link1Script")

This didn’t work and the connect method is only for connecting two signals to each other if i understand correctly. The F1-Help doesn’t get me any further right now.

Best regards
Dubsepp

 

 

Hello Dubsepp,
The Connections property is defined by a list of behaviors. You can assign them as following:

script = comp.findBehaviour("PythonScript")
boolSignal = comp.findBehaviour("BooleanSignal")
boolSignal.Connections = [script]

Keep in mind that the signal.Connections does not act like a normal python list, append and pop, for example, do not work.

If you need to defined more connections you need assign it to a list like the line below

boolSignal.Connections = [behaviour_1, behaviour_2, behaviour_etc]

Holms

1 Like

Thank you very much! That did the job!