---
title: "open_project"
description: "open_project — open a project for the session and return it."
url: "https://docs.justcat.it/reference/python-module/open-project/"
---
# open_project

## Signature

```python
cat.open_project(projectFilePath: str, loggingLevel: LoggingLevel = None)
```

## Parameters

| Parameter | Type | Default | Meaning |
|-----------|------|---------|---------|
| `projectFilePath` | str | required | A `.cat.yaml` file, or a directory with exactly one `*.cat.yaml`. Required. |
| `loggingLevel` | LoggingLevel | `None` | `cat.LoggingLevel` member; used only when this is the first call of the process. See [Logging](https://docs.justcat.it/reference/python-module/introduction/#logging "Logging"). |

## What it does

Runs the sign-in and plan check if this is the first call of the process, then opens the project: reads the file, loads data sources and tests from every list, generates metadata-driven tests. The project becomes *the* open project that `get_tests`, `get_data_sources`, `invoke_tests`, `invoke_command`, … work with. Opening another project replaces it; every open gives the tests new `TestDefinitionID`s.

## Returns

A `Project` object: `DataSources`, `DataSourceLists`, `Tests`, `TestLists`, `Queries`, `QueryLists`, `TestTemplates`, `Outputs`, `Threads`, `ProjectPathInfo` (`ResolvedPath`, `ResolvedDirectory`, `FileNameWithoutExtension`), `GetSummary()`. The `get_*` functions are shortcuts to its properties.

## Raises

The sign-in and plan check (first call of the process) raises the `CatPortalError` family listed on the [Introduction](https://docs.justcat.it/reference/python-module/introduction/ "Introduction") page. `PlanLimitExceededError` when the project is over a per-project cap of the plan (nothing is open afterwards). Any other reason the project cannot be opened — the path does not exist, no or several `*.cat.yaml` in the directory, a YAML error, an unreachable test list — raises the engine's `System.Exception: Failed to open the project file.`; the reason is in the log on standard output.

## Examples

```python
from justcatit import cat
p = cat.open_project("D:/Testing/DwhTests.cat.yaml")
print(p.ProjectPathInfo.ResolvedPath, len(p.Tests), "tests")

# open, run twice, close
cat.open_project("D:/Testing/DwhTests.cat.yaml")
smoke = cat.invoke_tests(include_tags="Smoke")
full  = cat.invoke_tests()
cat.close_project()
```

## Related

- [Introduction](https://docs.justcat.it/reference/python-module/introduction/ "Introduction") — session model, logging, .NET objects, exceptions, sign-in.
- [`invoke_project`](https://docs.justcat.it/reference/python-module/invoke-project/ "invoke_project") — open and run in one call.
- [`invoke_tests`](https://docs.justcat.it/reference/python-module/invoke-tests/ "invoke_tests") · [`get_tests`](https://docs.justcat.it/reference/python-module/get-tests/ "get_tests") · [`close_project`](https://docs.justcat.it/reference/python-module/close-project/ "close_project").

