Importing ansible.utils.color within custom modules

Here is a simple custom module, but when I try to import the ansible.utils.color then I get the error:

`
No module named ansible.utils.color

`

It seems I cannot import from anywhere but within ansible.module_utils.xxx
Can anyone advise on this?

Here is the module code:

`

#!/usr/bin/python

-- coding: utf-8 --

#---- Logic Start ------------------------------------------------------------#
import sys

import ansible.utils.color

def main():
module.exit_json(changed=True, something_else=str(sys.modules), version=PB_ANSIBLE_VERSION)

#---- Import Ansible Utilities (Ansible Framework) ---------------------------#
from ansible.module_utils.basic import *
module = AnsibleModule(
argument_spec = dict(
state = dict(default=‘present’, choices=[‘present’, ‘absent’]),
name = dict(required=True),
enabled = dict(type=‘bool’),
something = dict(aliases=[‘whatever’])
)
)
try:

since ansible 2.1.x

PB_ANSIBLE_VERSION = module.ansible_version[0]
except:
PB_ANSIBLE_VERSION = ANSIBLE_VERSION[0]

if name == ‘main’:
main()

`

modules cannot rely on any ansible code outside module_utils, this is
'special' and get's bundled into them, it is reserved for small common
libraries for modules.

To do what you want, you need ansible installed on all the targets.