I want to have a python application (app1) running that loads a bunch of data and functionality on start-up that I will use many many times. To avoid having to restart the application and re-load all that I would like to simply call a function inside that file whenever it is needed from another python application (app2). At the same time I would like to send arguments to said function from app2 and send the results back to it. What would I need to do in both files in order to make this request-response-type of interaction work?
I apologize if my phrasing is a bit confusing.
I tried letting the app that is supposed to send requests write to a csv file which the other app scans for entries, but I would like something more direct and efficient, that only does anything if a request is sent and stays dormant until the next request comes in.
Edit: App2 is only executed to send a new request, while App1 is running permanently. So App2 needs to trigger a function inside App1 which will calculate a result based on the information loaded by App1 and the arguments sent by App2.
Edit2: Image for clarification: Image