Say I have:
file1
file2
file3
Each of file1, file2, file3 have a dictionary called foo.
I have a different file named example_file that wants to read from file1, file2, file3.
from file1 import foo
from file2 import foo
from file3 import foo
# do something with file1.foo
# do something with file2.foo
# do something with file3.foo
Is there a way to do this through a loop?
for dynamic_name in something:
dynamic_name.foo # do something with foo
# dynamic_name resolves to file1, file2, file3 through the loop
Essentially, I want to use the file names from the imports to reference items in the files themselves.
Is this possible?