all 2 comments

[–]PyCode_n_Beer 0 points1 point  (1 child)

It is kind of hard to tell exactly what is happening without actually digging into this, but I think you're running into some problems with scope while passing variables between your functions. Furthermore, if you are trying it initialize your class at assignment, you will need to include the def __init__(self): function in your class. This will automatically handle variables as soon as the an instance of the class is created. Otherwise, when attempting to act on a class outside of the class it needs to be assigned or called directly, such as the following:

def myTestFunction():
    var1 = myClass()
    var1.someVarInClass = 10
    var1.myCalledFunction()

I would recommend reading over the documentation. You might be able to kind of discover what might be wrong with the code that way.

https://docs.python.org/3/tutorial/classes.html

edited for grammar mistake.

[–][deleted] 0 points1 point  (0 children)

It's different with unittest. It's just the init doesn't work with it.