programmatic invocations and dbt.invoke problems

The problem I’m having

Hello, I am trying to run dbt models from a Python script

The context of why I’m trying to do this

I am doing it for a personal project. I used Databricks as the connector and am using dbt 1.7.2 version.

What I’ve already tried

import os
from dbt.cli.main import dbtRunner, dbtRunnerResult

# initialize
dbt = dbtRunner()

# create CLI args as a list of strings
cli_args = ["run", "--profiles-dir","/path/to/the/dir"]

# run the command
res: dbtRunnerResult = dbt.invoke(cli_args)

# inspect the results
for r in res.result:
    print(f"{}: {r.status}")

Some example code or error messages

I am referring to this documentation: Programmatic invocations | dbt Developer Hub

Thanks in advance.