# Question on import statement in ansible module?

**URL:** <https://forum.ansible.com/t/question-on-import-statement-in-ansible-module/21159>\
**Category:** Ansible Project\
**Created:** [April 14, 2016, 3:01am UTC](https://forum.ansible.com/t/question-on-import-statement-in-ansible-module/21159 "2016-04-14T03:01:34Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pathangi\_Janardhanan](https://avatars.discourse-cdn.com/v4/letter/p/6bbea6/32.png) [@Pathangi\_Janardhanan](https://forum.ansible.com/u/Pathangi_Janardhanan)\
**Post date:** [April 14, 2016, 3:01am UTC](https://forum.ansible.com/t/question-on-import-statement-in-ansible-module/21159/1 "2016-04-14T03:01:34Z")

</div>

Hi,

I am in the process of writting a python module for Ansible, and in this I need to import a non-standard shipped python module. How should I solve this? Should I first ensure that I get it installed in the target hosts before the tasks using my module start executing, or is there any ways of having ansible temporarily copy over some modules etc.?

Thanks  
Jana

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [April 14, 2016, 8:34pm UTC](https://forum.ansible.com/t/question-on-import-statement-in-ansible-module/21159/2 "2016-04-14T20:34:49Z")

</div>

currently you just have to install on targets, we are working on features to allow to ‘bundle’ some imported modules, but this will be limited.

---

<div class="post-metadata">

**Author:** ![Mike\_Biancaniello](https://avatars.discourse-cdn.com/v4/letter/m/dec6dc/32.png) [@Mike\_Biancaniello](https://forum.ansible.com/u/Mike_Biancaniello)\
**Post date:** [April 14, 2016, 10:46pm UTC](https://forum.ansible.com/t/question-on-import-statement-in-ansible-module/21159/3 "2016-04-14T22:46:49Z")

</div>

Have you looked into creating an action\_plugin (runs on localhost) that uses the non-standard module to do what it needs to do, then calls your module to be run remotely, but not needing the py lib anymore? Depending on what the py lib is doing, this may be an option for you. Check out [https://github.com/ansible/ansible/tree/devel/lib/ansible/plugins/action](https://github.com/ansible/ansible/tree/devel/lib/ansible/plugins/action) for examples. template or copy might be good examples.
