I am new to python (I used do java a lot more) ,and need some help with a constructor. In class1.py I am calling this
print("about to create object")
object = class2.class_2(var1, var2, var3)
print("getting var1")
print(object.var1)
print(object.var2)
print(object.var3)
and in class2.py, I have this:
class class_2:
def __init__(self, var1, var2, var3):
print("initializing...")
self.var1 = var1
self.var2 = var2
self.var3 = var3
When calling this code, it prints "about to create object" as expected, but "initializing...", var1, var2, and var3 are never printed, and so the constructor is never even called. Please let me know what I am doing wrong. I also have other methods in class_2 that call var1 and var2, and they seem to say that those variables never exist (obviously, since the variables were never created).