First.py
x = 5
b = 6
from second import c
def print_():
result = c
print (ersult)
print_()
second.py
from First import x,b
class addition():
def process(self):
c = x + b
return c
the variables in the first file (first)
the second file obtain the variables then do the function
then the first file obtain the result from second file and do the function
I wonder is it possible!!! or the right choice is the variable be separated in third file, or if the code isn't long, combine all in the same file
This won't work correctly because you have a circular import.
First.py
imports fromsecond.py
and visa versa. Rather than trying to importFirst.py
into second, haveaddition.process
take the necessary parameters to do your computation, importaddition
intoFirst.py
, and calladdition.process
their:second.py
First.py