Here’s a tutorial I wrote on using components to help keep your code organized.

    • mrsgreenpotato@discuss.tchncs.de
      link
      fedilink
      arrow-up
      0
      ·
      18 days ago

      Correct, I’d also use exported values if possible. But that isn’t flexible enough in some cases, because you’d need to individually export all possible attributes that the node might have.

      For it to be more flexible, you could have something like this:

      for child in get_children():
        if child is ClassNameHere:
          return child
      

      That would give you the same result as described in the article, without string reference. You could make a static func for it and call it a day :)