How to initialize parallel independent process within function?

Sorry, if headline is strange. Let me explain.

Let’s say there is handler.py:

import funcs
import requests

def initialize_calculate(data):
   check_data(data)
   funcs.calculate(data) # takes a lot of time like 30 minutes
   print('Calculation launched')
   requests.get('hostname', params={'func':'calculate', 'status':'launched'})

and here is funcs.py:

import requests

def calculate(data):
   result = make_calculations(data)
   requests.get('hostname',params={'func':'calculate', 'status':'finished', 'result':result})

So what i want that handler can initialize another function no matter where, but doesn’t wait until it ends, because i want to notify client-side that process is started, and when it’s done this process itself will send result when it’s finished.

How can I launch independent process with function calculate from initialize_calculate?

If possible without non-native libraries or frameworks.

%d bloggers like this: