I work with a custom curve layer to help reveal hard to see detail.
Normally I add this curve to the file and then use a toggle the visibility script with a keyboard shortcut.
I would like to modify the toggle layer visibility scrip to to check if the custom curve exists in the file's layer pallet.
If the custom curve exists then toggle the visibility,
if the custom curve does not exist,
then add the custom curve,
then toggle the visibility
Which scripting tools can accomplish this sequence of events: