Sorry if I asked a silly question or made an obvious mistake as OOPS is not my strong point!
I have a project for which I am using Python. I have written all the code in a single function and it works as expected, giving proper output dataframe.
But when I try to break that one function into multiple functions all present in different .py files, all the files present in one local directory, the output then gets changed. The output dataframe then contains all nan values.
main.py (only one file which contains all the code)
def fn():
.
.
.
return x
Here x is the expected result and it works. But if I do this:
sub_module1.py (file #1)
class a:
def __init__(self):
pass:
def fn1(self, para1):
.
.
return x
sub_module2.py (file #2)
class b:
def__init__(self):
pass:
def fn2(self, para2):
.
.
return y
main.py (file #3)
from sub_module1 import a
from sub_module2 import b
x1 = a().fn1(para1)
x2 = b().fn2(para2)
def fn3(some parameters):
# some logic which makes use of x1 and x2
return new_x
new_x has nan values which don't make sense to me as the code is the same as used in main.py. The only difference is that instead of using one single function for the whole code, I have broken down the code into multiple functions which are stored in different python files but in the same directory and then I am calling those functions into one single python file(main.py) to get the output.
Any help is appreciated!