For engine classes, use
For custom classes, it's only possible to instance from script path. Also, script paths can be found at
ProjectSettings.get_setting("_global_script_classes"). So it's possible to get the script of a class by its class_name, even if you move the scripts around.
Or use a class from godot-next, ClassType, which implements everything about class for you. (Somehow it was slow last year I used it, I only use it for creating plugins though. )
To be honest, I don't know why custom classes aren't included in ClassDB. This is very inconvenient.