Subprocess Popen to call a tasks file python which cannot able to load models in Django

I have Django app ..we have several tasks file(stored into tasks folder). And we want to call those tasks file from

Now when we call

p = Popen("python","./tasks/", "jobid", stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True)
output_filename, err = p.communicate(b"input data that is passed to subprocess' stdin")

now in

from app.models import Job #its throwing error

It cannot import Models into where I have sent job id

from app.models import Job\r\nModuleNotFoundError: No module named \'app\'\r\n 

Folder structure

Back to Top