# Python project integration with Ansible API. After upgrading Ansible from 2.14 to 2.15, playbook execution failed

**URL:** <https://forum.ansible.com/t/python-project-integration-with-ansible-api-after-upgrading-ansible-from-2-14-to-2-15-playbook-execution-failed/3543>\
**Category:** Get Help\
**Created:** [January 31, 2024, 9:00am UTC](https://forum.ansible.com/t/python-project-integration-with-ansible-api-after-upgrading-ansible-from-2-14-to-2-15-playbook-execution-failed/3543 "2024-01-31T09:00:05Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jack](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/jack/32/2098_2.png) [@jack](https://forum.ansible.com/u/jack)\
**Post date:** [January 31, 2024, 9:00am UTC](https://forum.ansible.com/t/python-project-integration-with-ansible-api-after-upgrading-ansible-from-2-14-to-2-15-playbook-execution-failed/3543/1 "2024-01-31T09:00:05Z")

</div>

Background:  
We used Ansible’s Python API to execute Playbook, but recently Ansible is preparing to upgrade from 2.14 to 2.15. When executing Playbook, there will be an error message: No module named \ "Ansible\_collections. Ansible. builtin ".  
I found during debugging that the difference between 2.14 and 2.15 is that Ansible was not loaded\_ Builtin\_ Runtime.yml file. I would like to ask everyone how to solve this problem

Here is the code:  
playbook = PlaybookExecutor(playbooks=playbook\_path,  
inventory=inventory,  
variable\_manager=variable\_manager,  
loader=loader,  
passwords=passwords  
)

```
    result = playbook.run()

```

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [January 31, 2024, 5:41pm UTC](https://forum.ansible.com/t/python-project-integration-with-ansible-api-after-upgrading-ansible-from-2-14-to-2-15-playbook-execution-failed/3543/2 "2024-01-31T17:41:25Z")

</div>

Are you using [ansible-runner](https://ansible-runner.readthedocs.io/en/stable/index.html)? That’s the only public API for running playbooks I’m aware of. If you are using internals of ansible-core you should switch to using ansible-runner.

---

<div class="post-metadata">

**Author:** ![Sums123](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@Sums123](https://forum.ansible.com/u/Sums123)\
**Post date:** [May 6, 2024, 3:57pm UTC](https://forum.ansible.com/t/python-project-integration-with-ansible-api-after-upgrading-ansible-from-2-14-to-2-15-playbook-execution-failed/3543/3 "2024-05-06T15:57:44Z")

</div>

@jack Did you get any fix for the this issue No module named “ansible\_collections.ansible.builtin” ? I am facing the exact same error using PlaybookExecutor. Though I am aware of using public API but just wondering if you found solution for this.

---

<div class="post-metadata">

**Author:** ![felixfontein](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/felixfontein/32/7530_2.png) [@felixfontein](https://forum.ansible.com/u/felixfontein)\
**Post date:** [May 6, 2024, 5:29pm UTC](https://forum.ansible.com/t/python-project-integration-with-ansible-api-after-upgrading-ansible-from-2-14-to-2-15-playbook-execution-failed/3543/4 "2024-05-06T17:29:57Z")

</div>

I think you now need to explicitly initialize the plugin loader by calling `init_plugin_loader()`: [Add support for importlib.resources (#78915) · ansible/ansible@56d1423 · GitHub](https://github.com/ansible/ansible/commit/56d142350d62fb674e1c6874b3ace2cf5cb933a7#diff-6790274bc6447a6667f1825052d04d79d60c098cc1e03a252372b56bbd5aa146R1477)

---

<div class="post-metadata">

**Author:** ![Sums123](https://avatars.discourse-cdn.com/v4/letter/s/c37758/32.png) [@Sums123](https://forum.ansible.com/u/Sums123)\
**Post date:** [May 7, 2024, 9:57am UTC](https://forum.ansible.com/t/python-project-integration-with-ansible-api-after-upgrading-ansible-from-2-14-to-2-15-playbook-execution-failed/3543/5 "2024-05-07T09:57:23Z")

</div>

@felixfontein Thanks for the pointers. This worked as a workaround.
