I am able to get total process count using terminal commands. I have tried following command for process count-
ps aux | wc -l
And for thread count -
ps -eo nlwp | tail -n +2 | awk '{ num_threads += $1 } END " "{ print num_threads }'
But I don't want to use terminal command as its not allowed in my current project, is there any API or other method where I can get this information without invoking terminal.
I had tried using threading package but its showing at process level, I am getting output as 1.
I tried psutil but it gives info for individual process.
Additional info
OS - Ubuntu 16
Python 3.7.2