Python Forum
Ho can I get the first parent of a class?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Ho can I get the first parent of a class?
#1
I have a main class.
This creates another class, achild.
achild creates another class, bchild.
bchild can get it's parent (achild) by self.parent(), but how can it get it's grandparent (main class)?

(ok, maybe I could use self.parent().parent(), but what about bchild 's children? how would they access to main class?)

Would it be a good practice if all children imported main class?
It doesn't seem very good to me.
Reply


Messages In This Thread
Ho can I get the first parent of a class? - by panoss - Jan-09-2017, 01:10 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020