## add_root()


Append *directory* to the kernel roots and save (#48).


Usage

``` python
add_root(
    directory,
    config=None,
)
```


The directory is created when missing. A root that is already present is not added twice, and the order of the others is kept. The function runs no prompt, so planetarypy can call it. Without a config file one is written with the default database path.

The CLI equivalent is `skd config add-root` (see "Several kernel roots" in the CLI documentation).


## Parameters


`directory: str | Path`  
The directory to add.

`config: Config | None = None`  
A configuration to edit instead of loading the file.


## Returns


`Config`  
The updated configuration.


## Examples

``` python
>>> from spice_kernel_db import add_root, kernel_roots
>>> add_root("~/planetarypy_data/spice_kernels")
>>> kernel_roots()
```

\[PosixPath('/Users/me/.local/share/spice-kernel-db/kernels'), PosixPath('/Users/me/planetarypy_data/spice_kernels')\]
