title: how to update global variable in python
body: <p>In python, i have a function that returns a list of the latest links(to folders) on a website. I also have another function that downloads the latest files from those folders. I plan to run this script everyday. I have a global list with the folder links that the download function accesses everytime it runs for the latest folders. I want to update that global list every five days and keep it static for the next 5 days i run the code until it updates again.</p>
  
  <p>Its sort of like this:</p>
  
  <pre><code>list = ["link1", "link2",...]
  
  def update():
    #code to update list
    return list
  
  def download(list):
    #code to download from links
  </code></pre>
  
  <p>So I want the update function to run every 5 days(I know how to do that) and the download function to run everyday. So how can i keep the list returned from update() static as the global list until it is updated again?</p>
  
  <p>EDIT:
  Let me try to clarify:</p>
  
  <p>I run this on a monday:</p>
  
  <pre><code>list = ["link1", "link2"]
  
  def update():
    #code to update list
    return list #--&gt; list = ["link1", "link2", "link3"]
  
  def download(list):
    #code to download from links
  </code></pre>
  
  <p>this worked fine, list was updated and used in download().</p>
  
  <p>I run this on a Tuesday:</p>
  
  <pre><code>list = ["link1", "link2"]
  #update() won't run today, only runs every 5 days
  def update():
    #code to update list
    return list #--&gt; list = ["link1", "link2", "link3"]
  
  def download(list):
    #code to download from links
  </code></pre>
  
  <p>I restarted my code, but now list doesnt have link3 from monday. How do i keep link3 in the list for the next 5 days until i update list again?</p>
  
  <p>Thanks</p>