Reading config file in a plugin

How can I read a config file from a plugin? I tried opening the file, but the CWD is the directory I launched my playbook from. I can get the playbook directory, but if they called my plugin from a playbook outside the collection, this may not help me traverse to the plugins folder in my collection.

Is there some way to get the plugin path or the collection path?

I want to do something like this:

class LookupModule(LookupBase):
def run(self, terms, variables=None, **kwargs):
with open(‘config.yaml’, ‘r’) as f:
c = yaml.safe_load(f)

do something with c

Is there some way I can know where config.yaml will be relative to the LookupModule file so I can open it?

Thanks,

–John

I ended up using file from python.