Get Variable from another scipt in the same scene

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Bot7

I am trying to check if a variable in the same scene has a spesific value but it doesnt work

if $UI.change_Camera == false:
print(“hello World”)

:bust_in_silhouette: Reply From: code

First question is that code you wrote contained in the parent that contain the node

If it is not a parent but a fellow child of the parent then use something like this

get_parent().get_node(UI).change_Camera

It works! Thank you for your answer.

Bot7 | 2021-03-02 22:32