title: Run code on Python Flask AppEngine startup in GCP
body: <p>I need to have a TCP client that listens to messages constantly (and publish pub sub events for each message)</p>
  <p>Since there is no Kafka in GCP, I'm trying to do it using my flask service (which runs using AppEngine in GCP).</p>
  <p>I'm planning on setting the <code>app.yaml</code> as:</p>
  <pre><code>manual_scaling:
    instances: 1
  </code></pre>
  <p>But I can't figure out how to trigger code on the flask app startup.</p>
  <p>I've tried running code in the <code>main.py</code> and also tried to manipulate the <code>main</code> function in it - but it obviously doesn't work as AppEngine doesn't run it.</p>
  <p>Do you have any idea how can I init the listener on the Flask' app startup?</p>
  <p>(Or any other offer regarding how should I implement a tcp client that sends pubsub events, or inserting to Big Query?)</p>