How to get all groups of a scene at runtime?

Godot Version

Godot 4.3

Question

How to get all groups of a scene at runtime?

There is no built-in function for this.
You could have one node be in all your groups and then
use get_all_groups() on that node.
Save them in a variable inside a static script or an autoload and then free that node.