Dynamic Inventory on VMWare not working; but works when the script is run directly

I am trying to implement Dynamic Inventory for VMWare with the vmware_inventory.py script
From here :
https://github.com/ansible/ansible/blob/devel/contrib/inventory/vmware_inventory.py

I have searched for docs on the ansible site and also google searched and there is nothing useful.

the script vmware_inventory.py works and produces a list of VMs when run directly

. python2 vmware_inventory.py

But when i try this
ansible -i vmware_inventory.py all -m shell -a “cat /etc/redhat-release”

nothing happens

This is from my ansible.cfg

[inventory]
enable_plugins = vmware_vm_inventory, host_list, script, yaml, ini, auto

I created a vmware.yml file in /etc/ansible but no luck. There are no details as to what is required to get this working

https://docs.ansible.com/ansible/latest/plugins/inventory/vmware_vm_inventory.html

vmware.yml

# Sample configuration file for VMware Guest dynamic inventory
    plugin: vmware_vm_inventory
    strict: False
    hostname: 10.65.223.31
    username: administrator@vsphere.local
    password: Esxi@123$%
    validate_certs: False
    with_tags: True