This is what my two modules "mod1.py" and "outmod1.py" looks like
--mod1.py
class B:
varb=10
def bkafunc(self):
print("Mai B class ka func!")
--outmod1.py
from my_package.mod2 import B
class outMod:
b=B()
def func_out_mod(self):
print(b.varb)
om=outMod()
om.func_out_mod()
Error: NameError: name 'b' is not defined. Did you mean: 'B'? ## this is the error im getting
//But when i write the "outmod1.py" code as below it works and prints 10 which is value of 'varb':
from my_package.mod2 import B
class outMod:
def func_out_mod(self):
print(B().varb)
om=outMod()
om.func_out_mod()