I have a class with a list. I am trying to return the list in a different class, but it returns the list as the original empty list instead of the new list with elements (SOLVED!!).
class Whatever:
def __init__(self,thing):
self.list=[]
self.thing=thing
def list_append(self):
df1=pd.read_csv('job.py')
df2=pd.read_csv('home.py')
self.list.append([df1,df2])
return self.list
def new_function(self):
return self.list
function=Whatever('thing1')
function_output=function.new_function()
print(function_output)
list_append(), so of courseself.listis still in its original empty state.list_append()is never called.