# Run python functions in dbt dag

**URL:** https://discourse.getdbt.com/t/run-python-functions-in-dbt-dag/10819
**Category:** Help
**Tags:** python-models, dbt\_project-yml, dbt-core
**Created:** [November 16, 2023, 9:21am UTC](https://discourse.getdbt.com/t/run-python-functions-in-dbt-dag/10819 "2023-11-16T09:21:16Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ajmal92](https://avatars.discourse-cdn.com/v4/letter/a/a87d85/32.png) [@ajmal92](https://discourse.getdbt.com/u/ajmal92)
#### Post date: [November 16, 2023, 9:21am UTC](https://discourse.getdbt.com/t/run-python-functions-in-dbt-dag/10819/1 "2023-11-16T09:21:17Z")

</div>

## The problem I’m having

I have some python scripts that need to be run after a model x has been refreshed. after this step has been completed. This is typically run at the end of raw refresh [ie, after all the tables with tags “raw” has been refreshed].  
The .py script is used to run .sh file that tokenizes the data from the tables of interest.

## What I’ve already tried

I tried to call a py script in on-run-end in dbt\_project.

## Some example code or error messages

```auto
on-run-end:
  - python /home/x/Documents/repos/dbt_prroject/test/your_python_script.py

```
