Check if certain sticky exists or if has value?

How can I check if certain sticky value exists or has value to avoid certain errors.

if sticky(object) exists:
    delete object
    sticky = new object

Hi @ivelin.peychev, you might try to use has_key as shown below:

import scriptcontext

key = "Rhino"
if scriptcontext.sticky.has_key(key):
    print "Key '{}' exists in sticky".format(key)
    print "Key '{}' was not found in sticky".format(key)


Thanks @clement,

The behavior is the same as my script, I assume it’s not the sticky but the deleting of the clipping plane that causes this exception.

@ivelin.peychev, if you post the definition and document i can investigate what happens.


I opened another thread to keep this clean only for the sticky