I come across with an error of isinstance() returning false with a child instance and its parent class set as parameters. Also from debugging, I found out with child.__bases__ that it does not have a parent class. I have followed through guidelines of setting up a child class and initializing the parent class in child.__init__ using super().__init__. I believe I know some problems but want to hear other suggestions on it.
- When you run a python program, main.py, with a class, x, with
from folder.x import X, if the class X is in a different directory from main imports another class, y that is in the same directory as x.py, do we need to put in the directory,from folder.y import Ysince main.py is in a different directory, or do we not need to include a path to y.py since y.py is in the same directory as x.py? This might link into the reason why my child class does not have a parent class since the child class file and parent class file are in the same directory but different from main.py.
I'll update on what other potential problems, but thank you in advance for looking into this!
https://stackoverflow.com/questions/65573112/isinstance-of-a-child-class-instance-and-parent-class-returns-false January 05, 2021 at 12:04PM
没有评论:
发表评论