I am instantiating this object below every time I call csv in my function. Was just wondering if there's anyway I could just instantiate the object just once? I tried to split the return csv from def csv() to another function but failed.
Code instantiating the object
def csv():
proj = Project.Project(db_name='test', json_file="/home/qingyong/workspace/Project/src/json_files/sys_setup.json")#, _id='poc_1'
csv = CSVDatasource(proj, "/home/qingyong/workspace/Project/src/json_files/data_setup.json")
return csv
Test function
def test_df(csv,df)
..............
csvObj = csv() # since you're returning csv object in the function csv()csvfunction, it is passing thecsvfunction intotest_df, you don't show it being called. Maybe part of your confusion is that you have a namecsvused inside the function of the same name - a bad idea.