Is there a object.has_var("var")?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By mateusak
:warning: Old Version Published before Godot 3 was released.

I can do a setter and getter and just use has_method(“getter”), but is there a more convenient way to just verify if the object has a variable?

:bust_in_silhouette: Reply From: tiernich

Check my question here some time ago about the same subject: link

Weird how you marked the answer that requires you to do the additional step of including a method in your script.

blurrred | 2022-03-18 20:16

:bust_in_silhouette: Reply From: kubecz3k

You can check this with in keyword. Like for example:

if "varName" in get_parent(): print("varName is defined in parent!")