How to import custom Python modules in the dbt models

Hi there


I trying to import model in the dbt model by providing the path


from test.filter_out import filter_out

But not able import it. But it is expecting some

But dbt is not working properly with

Any idea what is causing this problem. Let me know if there are any other details that would help.

Hi @Sam777,

You can define and reuse functions inside of a single model, but you can’t currently define a function in one model and reuse it in another: Python models | dbt Developer Hub

This is a work in progress - you can see the Code reuse section of that same doc discusses some different options we’re considering for the future.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.