How do I get the name of the scene?

get_tree().get_current_scene().get_name() returns null

I just tested that, and it worked.

This is equivalent:
get_tree().current_scene.name

Try this:

print_debug(get_tree())
print_debug(get_tree().current_scene)
print_debug(get_tree().current_scene.name)
    2 months later

    I just tested the code in my previous post in Godot 4.0.4, and it worked.

    Can you post a minimal reproduction project that illustrates the problem?