'Why can't I use a variable immediately after it is initialised in a class? [closed]

Why can't I use a variable immediately after it is initialised in a class?

1. class A:
2.     var1 = <call_to_a_function_outside_class_A>
3.     Var2 = <something_to_with_var1>
....

I get

NameError: name 'var1' is not defined (at line number 3)

What am I missing?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source