title: How can I update Python code based on API endpoint?
body: <p>I'm working in a voice assistant, made with Python, and I want to be able to update my code when a newer version of the script is avaliable (I'll use a API endpoint to do that). This endpoint would be something like this:</p>
  
  <pre><code>{
      "version": "0.10",
      "date": "01/06/2020",
      "commands:" [
          {"keyword": "hey", "action": "say('hello')"},
          ...
      ]
  }
  </code></pre>
  
  <p>Note that I have Python code in the endpoint, and I want to replace the local copy by that code in the API.</p>
  
  <p>The api check logic I have so far looks like this:</p>
  
  <pre><code>if new_version &gt; actual_version:
      update() -&gt; *download the code and update the local copy*
  else:
      pass
  </code></pre>
  
  <p>The proble is: what I'm trying to update it's the <strong>code itself</strong>.</p>
  
  <p>Is that possible?</p>
  
  <p>I'm also thinking in updating a Python module, and the restarting the app to catch the updates.</p>