# Run All Intermediate Models in a Python Model

**URL:** <https://discourse.getdbt.com/t/run-all-intermediate-models-in-a-python-model/7857>\
**Category:** Help\
**Tags:** python-models, dbt-core\
**Created:** [April 15, 2023, 7:57am UTC](https://discourse.getdbt.com/t/run-all-intermediate-models-in-a-python-model/7857 "2023-04-15T07:57:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![armsepehr](https://avatars.discourse-cdn.com/v4/letter/a/d26b3c/32.png) [@armsepehr](https://discourse.getdbt.com/u/armsepehr)\
**Post date:** [April 15, 2023, 7:57am UTC](https://discourse.getdbt.com/t/run-all-intermediate-models-in-a-python-model/7857/1 "2023-04-15T07:57:33Z")

</div>

I have a python model in the mart folder and then I would like to run all sql model includes in intermediate folder. I tried to list the directory files and then run `dbt.ref()`; but it gave me the following error.

```auto
Error when trying to literal_eval an arg to dbt.ref(), dbt.source(), dbt.config() or dbt.config.get() malformed node or string: <ast.Name at something>

```

How can I run all models include in the intermediate folder dynamically? Note that intermediate models have specific filename such as `int_<name>`.
