How to get the script name from python?

Hi,

To find the name of the script that you are in right now you can use this:

print comp.findBehaviour(__file__.split("::")[1]).Name

if you want to add a signal to the script you are in right now you can use:

currentScript = comp.findBehaviour(__file__.split("::")[1])
signal = comp.findBehaviour("someSignal")
if not currentScript in signal.Connections:
  connections = signal.Connections
  connections.append(thisScript)

I hope this helps, if not, let me know!

1 Like