# Accept both " import \*" and " import AnsibleModule"

**URL:** <https://forum.ansible.com/t/accept-both-import-and-import-ansiblemodule/20788>\
**Category:** Ansible Project\
**Created:** [March 7, 2016, 7:50am UTC](https://forum.ansible.com/t/accept-both-import-and-import-ansiblemodule/20788 "2016-03-07T07:50:16Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dbarrosop](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@dbarrosop](https://forum.ansible.com/u/dbarrosop)\
**Post date:** [March 7, 2016, 7:50am UTC](https://forum.ansible.com/t/accept-both-import-and-import-ansiblemodule/20788/1 "2016-03-07T07:50:16Z")

</div>

Hello,  
in [PR #14805](https://github.com/ansible/ansible/pull/14805) I provided a one line patch to allow writing modules with both:

`from ansible.module_utils.<lib name> import *`

and

`from ansible.module_utils.<lib name> import AnsibleModule`

As you can see in the [build](https://travis-ci.org/ansible/ansible/builds/113691610) this extremely simple patch doesn’t break anything.

The reasoning behind the patch is to be able to write PEP8 compliant code (wildcard imports are discouraged).

I understand that ansible does very ‘interesting’ things with that line as it is replaced by code coming from other sources to ship a single flat file. The problem is that the line we are talking about, despite as doing something very ansible specific, looks like an import (humans, IDEs and linters alike think that’s just another regular import) so linters/IDEs trying to comply to PEP8 complains about the line.

That simple patch, addresses the issue described here and allows you to write PEP8 compliant code without breaking any functionality.

Thanks.  
David

---

<div class="post-metadata">

**Author:** ![dbarrosop](https://avatars.discourse-cdn.com/v4/letter/d/7ab992/32.png) [@dbarrosop](https://forum.ansible.com/u/dbarrosop)\
**Post date:** [March 7, 2016, 7:52am UTC](https://forum.ansible.com/t/accept-both-import-and-import-ansiblemodule/20788/2 "2016-03-07T07:52:55Z")

</div>

Disregard this mail. I already wrote about this topic. I thought there had been some error last time but it was correctly published.

Sorry for the spam.
