I have the following function in a Python module called dictbuilder.py:
def my_dictbuilder(reader_o, writer):
fieldnames = ('name', 'number')
reader = csv.DictReader(reader_o, fieldnames = fieldnames, delimiter="\t")
my_dict = {}
id = 0
for row in reader:
id += 1
my_dict[id] = row['name'], row['number']
id += 1
return(my_dict)
I have imported and called this function from a module called main.py. I would like to also use the my_dict variable from the dictbuilder.py module I have imported into main.py. When I try to printmy_dictbuilder.mydict I get this error:
AttributeError: 'function' object has no attribute 'my_dict'
Can anyone help me figure out how to access the my_dict variable from my main.py file? Thanks for the help!