# single instance of module trough playbook execution

**URL:** <https://forum.ansible.com/t/single-instance-of-module-trough-playbook-execution/33893>\
**Category:** Ansible Project\
**Created:** [September 25, 2020, 12:07am UTC](https://forum.ansible.com/t/single-instance-of-module-trough-playbook-execution/33893 "2020-09-25T00:07:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![thlanzer](https://avatars.discourse-cdn.com/v4/letter/t/f1d935/32.png) [@thlanzer](https://forum.ansible.com/u/thlanzer)\
**Post date:** [September 25, 2020, 12:07am UTC](https://forum.ansible.com/t/single-instance-of-module-trough-playbook-execution/33893/1 "2020-09-25T00:07:18Z")

</div>

Hello guys

I work with an API that is pretty old and only supports get of a whole bunch of data objects.  
The data is quite complex as I decided to define my own module/plugin to parse and store the result in memory by using a dictionary with support of lookup by a specific keyword.

So what I wanted is to run once the data into memory and do multiple lookups in different tasks. Unfortunately the python class gets constructed for every call…  
I tested outside of ansible using a module (subfolder & \_\_init\_\_py). Like this I have singleton behavior.  
Unfortunately I did not find a way inside of ansible to do this.

So might you know how to build a singleton or where to store a module folder to import from my custom module (like import custom.myparser)?

many thanks in advance!
