# Running python3 script from ansible

**URL:** <https://forum.ansible.com/t/running-python3-script-from-ansible/35299>\
**Category:** Ansible Project\
**Created:** [June 7, 2021, 8:18pm UTC](https://forum.ansible.com/t/running-python3-script-from-ansible/35299 "2021-06-07T20:18:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![John\_Menke](https://avatars.discourse-cdn.com/v4/letter/j/8491ac/32.png) [@John\_Menke](https://forum.ansible.com/u/John_Menke)\
**Post date:** [June 7, 2021, 8:18pm UTC](https://forum.ansible.com/t/running-python3-script-from-ansible/35299/1 "2021-06-07T20:18:04Z")

</div>

I have a python3 script that i want to run from a playbook that is using the python2 interpreter. Is this possible?

-john

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/ansible/original/1X/1882d9a01da5d8996a862359b0913cc568a39b84.svg) [@system](https://forum.ansible.com/u/system)\
**Post date:** [June 7, 2021, 11:44pm UTC](https://forum.ansible.com/t/running-python3-script-from-ansible/35299/2 "2021-06-07T23:44:32Z")

</div>

Yes,

Simplest way is using the 'script' action and make sure the shebang on  
the script points to the python3 you want.

---

<div class="post-metadata">

**Author:** ![John\_Menke](https://avatars.discourse-cdn.com/v4/letter/j/8491ac/32.png) [@John\_Menke](https://forum.ansible.com/u/John_Menke)\
**Post date:** [June 8, 2021, 3:06pm UTC](https://forum.ansible.com/t/running-python3-script-from-ansible/35299/3 "2021-06-08T15:06:10Z")

</div>

Thanks Brian!
