title: Dynamic Function Calling From a Different File - Python
body: <p>I have 2 python files. One file has all of the functions, the other file has a function which calls functions from the first file. Here is a simplified version of what I have.</p>
  <p>file1.py</p>
  <pre><code>def one():
          print(&quot;Hello World&quot;)
  def two():
          print(&quot;Salutations Earth&quot;)
  def three():
          print(&quot;Greetings World&quot;)
  </code></pre>
  <p>file2.py</p>
  <pre><code>import file1
  function_id = input(&quot;Which function would you like? Please enter(one, two or three): &quot;)
  file1.function_id()
  </code></pre>
  <p>Clearly, this is not going to work because there is no function named 'function_id' in file1. However, I am not sure how to call the functions from file1 dynamically. I looked on <a href="https://www.youtube.com/watch?v=09v4BfM5wAg&amp;t=217s" rel="nofollow noreferrer">youtube</a> and one of the videos suggested to use eval() but it did not work for me. Thank You for your time!</p>