return a new instance class from within said class?

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

How do I return a new instance of my class from within my class?

class Thing:
    var stuff = null

    func _init(s):
        self.stuff = s

    func do_something():
        # .... do something
:bust_in_silhouette: Reply From: Zylann

It’s a known issue, that people are trying to address: GDScript: automatic dependency resolution for inner classes by poke1024 · Pull Request #15818 · godotengine/godot · GitHub

Currently I think you can workaround it by using get_script().new(result)