Python - pexpect script with command line argument

I am trying to create a python script that I can run with some command line arguments. I am not a python dev at all, just trying cut/paste what I can salvage from the net.

my command would be as follows I need to pass the following argument ‘SetAnalogOut 1,200’ to turn on a switch

execute command:
python3 switch.py SetAnalogOut 1,200

current python script:

import pexpect
import sys

child = pexpect.spawn('/usr/bin/telnet 192.168.2.6 2020')
child.expect('>Ready')
child.sendline('\r')
child.sendline('Pass mypassword\r')
child.sendline('sys.argv[0]')

Unfortunately the above is not working

Returns the name of the script.

sys.argv[1] should return SetAnalogOut
sys.argv[2] should return 1,200

EDIT
Also child.sendline('sys.argv[0]') sends the string 'sys.argv[0]'
I think this should be child.sendline(sys.argv[1] + ' ' + sys.argv[1])

Thank you for your support; got the script part working now.
Now I want to get the status reported correctly in home assistant, would the following work below?

- platform: command_line
  scan_interval: 60
  switches:
   light_keuken_spot_rechts:
        command_on:  "pyton3 /opt/ha/switch.py SetAnalogOut 1,255"
        command_off: "pyton3 /opt/ha/switch.py SetAnalogOut 1,0"
        command_state: value_template: '{{ value = "1" }}'
        friendly_name: Spot right

switch.py

import pexpect
import sys
child = pexpect.spawn('/usr/bin/telnet 192.168.2.6 2020')
child.expect('>Ready')
child.sendline('\r')
child.sendline('Pass mypassword\r')
child.sendline(sys.argv[1] + ' ' + sys.argv[2])
exit(1)