How to change handheld orientation using gdscript?

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

Exactly as it says. I want to change the handheld orientation using gdscript. I know I can set it in the project settings but I can’t seem to change it using gdscript. I even tried doing something like this

print(get("display/window/handheld/orientation"))

to see if It exist because the description labeled it as such and it returns

null

So can anyone teach me how to access and change handheld orientation

:bust_in_silhouette: Reply From: MrEliptik

Looking at the doc, it seems you need to use OS.screen_orientation with whatever orientation you want.

Here’s the property OS — Documentation de Godot Engine (4.x) en français and here are the different orientations you can use: OS — Documentation de Godot Engine (4.x) en français