title: How can i refresh the current date inside a running Python process?
body: <p>I'm using <code>supervisord</code> to keep a Telegram bot developed with Python running on a server and I'm using the datetime library to get the current date and perform an operation that depends on the current date.</p>
  <pre><code>from datetime import date
  
  
  today = date.today()
  </code></pre>
  <p>The problem: I noticed that, when the process is running, the Python always returns the same date; so, my bot doesn't return a different output each day, but the same.</p>
  <p>To solve that, I had to enter the server, stop supervisor, kill the process and, manually, execute the python script to run the bot with the current date.</p>
  <p>I thought about using a crontab to run <code>supervisorctl restart all</code> one time per day, but when i run that command the Python process doesn't stopped, even when I killed the process and run that command the output still returned the date of yesterday, I needed to manually run <code>python3 myfile.py</code> to refresh it. There is a way that I can actualize the Python date.today() without killing the process, or a way that I can kill and restart the Python process refreshing the current date?</p>
  <p>The current code:</p>
  <pre><code>def get_today_meditation(update, context):
      chat_id = update.message.chat_id
      today = date.today()
      print(today)
      [ ... ]
  
  
  def main():
      key_api = os.environ.get('PYTHON_API_BREVIARIO_KEY')
      locale.setlocale(locale.LC_ALL, &quot;pt_BR.UTF-8&quot;)
      updater = Updater(key_api, use_context=True)
      dispatcher = updater.dispatcher
      dispatcher.add_handler(CommandHandler('meditacaodehoje', get_today_meditation))
      updater.start_polling()
      updater.idle()
  
  
  </code></pre>