title: Search through dictionaries in another python file from string list
body: <p>I have 2 files in a python directory. PyDir.File1.py contains dictionaries in this format:</p>
  <pre><code>PyDir.File1.py:
  
  dict_1 = {records: &quot;A&quot;, ...}
  dict_2 = {records: &quot;B&quot;, ...}
  dict_3 = {records: &quot;C&quot;, ...}
  </code></pre>
  <p>PyDir.File2.py imports PyDir.File1.py and has a list of strings with the string dictionaries I intend to call. I know I can call the dictionaries individually by importing them and calling them like this:</p>
  <pre><code>PyDir.File2.py:
  
  import PyDir.File1
  
  all_dicts = PyDir.File1
  saved_dict = all_dicts.dict_1
  print(saved_dict)
  </code></pre>
  <p>But is there anyway to access the dictionaries in File1 by passing it a list of strings as an argument? I have tried:</p>
  <pre><code>import PyDir.File1
  
  dict_list = [&quot;dict_1&quot;, &quot;dict_2&quot;]
  all_dicts = PyDir.File1
  for i in range(len(dict_list)):
      saved_dict = all_dicts[dict_list[i]]
      print(saved_dict)
  </code></pre>
  <p>And this gave me an error:</p>
  <pre><code>TypeError: 'module' object is not subscriptable
  </code></pre>
  <p>And I have tried to pass it as an extension of the address:</p>
  <pre><code>saved_dict = all_dicts.dict_list[i]
  </code></pre>
  <p>Any suggestions are appreciated.</p>