Django thread for opc ua/ modbus connection

Hi all,
I have a question, is it possible to make a thread in Django for opc ua or modbus communication with a plc and how can I do it?
Thanks in advance

In the general case, no, you do not want to try and manage threads within your Django instance.

Basically, my general principle is that “you” don’t control the Django process. The wsgi container (uwsgi, gunicorn, etc) is in control. I always recommend against starting any kind of thread or process from within Django itself - there are too many ways that things can go wrong because you’re not in charge of the base process.)

My standard recommendation is to set up an external process to handle communications with external devices, then use some form of IPC to manage the communications between the two.

For more thoughts on this see the threads at:

Thank you very much for the quick answer!!