I have a python script which receives data from NodeJS, uses it to gather data and then sends this data back to the NodeJS server any time a request is made.
The problem is that a part of this python script loads a lot of data from an external source meaning it takes a while to run so its not ideal that it ends after every single request just to have to reload the data again when the next request is sent (this loading the external data process can take up to 8 seconds each time a request is made).
How can I have a Python script that runs as a background process when the server starts and does not close until the server closes while still being able to receive and send data?
I have tried Pyshell but it seems that it isn't meant for running a constant file that sends and receives data in real time.
Thanks a lot!