@Arun-Soman
What you have there is the command line tool for PWM expansion. For python program you need to use python library instead. check the following document
https://docs.onion.io/omega2-docs/pwm-expansion-python-module.html