I’ve created a custom python module under /home/ubuntu/custom_module.py, and I’m trying to import it into my Python datasource like so:

However, I can’t reference custom_module at all when using this datasource, nor the function inside of it. I just get Error running query: <type 'exceptions.NameError'> name 'custom_module' is not defined.

Has anyone been able to successfully include their own module, and how do you go about doing it?

After debugging further, I found that I had a syntax error in my module (doh). I’m now trying to access redash’s execute_query() function from within my module, and I’m getting:

Error running query: <type 'exceptions.NameError'> global name 'execute_query' is not defined

I figure I have to import modules from redash to gain access to these functions, but I’m not sure which ones to import. Has anybody tried to accomplish this?

Some background, my module is meant to accept a query, loop through and run the query against 15 datasources, and then return the concatenated results. Any help is greatly appreciated, I’m new to python :slight_smile:

hi, have u solved this problem?