# accessing vars from lookup

**URL:** <https://forum.ansible.com/t/accessing-vars-from-lookup/23917>\
**Category:** Ansible Developer\
**Created:** [March 8, 2017, 7:59pm UTC](https://forum.ansible.com/t/accessing-vars-from-lookup/23917 "2017-03-08T19:59:50Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Guy\_Matz1](https://avatars.discourse-cdn.com/v4/letter/g/b5e925/32.png) [@Guy\_Matz1](https://forum.ansible.com/u/Guy_Matz1)\
**Post date:** [March 8, 2017, 7:59pm UTC](https://forum.ansible.com/t/accessing-vars-from-lookup/23917/1 "2017-03-08T19:59:50Z")

</div>

Hello! I hope this is the correct mailing-list for this question . . . I’m writing a custom lookup function and would like to access group\_vars from it. They seem to be passed to the run method of the LookupModule class as “variables”, the signature for the method looking like this:  
def run(self, terms, variables=None, \*\*kwargs)

This is good, except that the variables var is set with the “un-expanded” variables, so that if I have the following defined in my group\_vars:  
b: http://{{ a }}.com/asdff

I get http://{{ a }}.com/asdff instead of [http://foo.com/asdff](http://foo.com/asdff) . . . anyone know how I can get the expanded var?

Thanks!!
