# xarray.DataTree._\_getitem_\_

#### DataTree.\_\_getitem_\_(key)[[source]](https://github.com/pydata/xarray/blob/main/xarray/core/datatree.py#L1016-L1049)

Access child nodes, variables, or coordinates stored anywhere in this tree.

Returned object will be either a DataTree or DataArray object depending on whether the key given points to a
child or variable.

* **Parameters:**
  **key** ([`str`](https://docs.python.org/3/builtins/stdtypes.html#str)) – Name of variable / child within this node, or unix-like path to variable / child within another node.
* **Returns:**
  `DataTree | DataArray`
