Issue calling Python script with asyncio

I am not sure if this is the right place or not but maybe someone can help.

I have a script that controls a Cisco video endpoint. However, I’m getting this error: asyncfunctiondef statements are not allowed.

import xows
import asyncio

async def start():
    async with xows.XoWSClient('XXX', username='admin', password='XXXX') as client:
        call_start = await client.xCommand(['Dial'], number='[email protected]')
        if call_start['status'] == 'OK':
            call_state = await client.xQuery(['Status', 'Call', 'AnswerState'])
            call_state = call_state['Status']['Call'][0]
            call_state = call_state['AnswerState']
            while call_state != 'Answered':
                call_state = await client.xQuery(['Status', 'Call', 'AnswerState'])
                call_state = call_state['Status']['Call'][0]
                call_state = call_state['AnswerState']

            dtmf_send = await client.xCommand(['Call', 'DTMFSend'], DTMFString='3998#')
            if dtmf_send['status'] == 'OK':
                print('done!')

        await client.wait_until_closed()

print('Done')
asyncio.run(start())


I’m a newb with Python…any advice or alternative would be helpful!

Is this for use with the python_script integration?

If it is then it has the following constraint:

It is not possible to use Python imports with this integration. If you want to do more advanced scripts, you can take a look at AppDaemon

Ah, gotcha. Yes - it is indeed from python_script…

Thanks,

Nate