I have a parent class in one file, a child class in another, and I'm trying to use them in a third. Example:
test1.py
class Parent(object): def spam(self): print "something"
test2.py
class Child(Parent): def eggs(self): print "something else"
test3.py
from test1 import * from test2 import * test = Child()
running test3.py gives me the following:
File "[path]\test2.py", line 1, in <module> class Child(Parent): NameError: name 'Parent' is not defined
Do you just need to keep the parent and child classes in one place?
source share