# uproot.writing.identify.add_to_directory

Defined in [uproot.writing.identify](https://github.com/scikit-hep/uproot5/blob/db953cf9827349b3d24eb6742404158c1dfd5481/src/uproot/writing/identify.py) on [line 35](https://github.com/scikit-hep/uproot5/blob/db953cf9827349b3d24eb6742404158c1dfd5481/src/uproot/writing/identify.py#L35).

### uproot.writing.identify.add_to_directory(obj, name, directory, streamers)

* **Parameters:**
  * **obj** – Object to attempt to recognize as something that can be written to a
    ROOT file.
  * **name** (*str* *or* *None*) – Name to assign to the writable object.
  * **directory** ([uproot.WritableDirectory](uproot.writing.writable.WritableDirectory.html.md)) – Directory to
    add the object to, if successful.
  * **streamers** (list of [uproot.streamers.Model_TStreamerInfo](uproot.streamers.Model_TStreamerInfo.html.md), uproot.writable._cascade.RawStreamerInfo, or constructor arguments for the latter) – Collects
    streamers to add to the output file so that all objects in it can be read
    in any version of ROOT.

This function performs two tasks: it attempts to recognize `obj` as a writable
object and, if successful, writes it to a `directory`.

It can recognize dynamic TTrees and static objects such as histograms. For only
static objects, without the additional concern of writing the resulting object
in a `directory`, see [uproot.to_writable](uproot.writing.identify.to_writable.html.md).

Raises `TypeError` if `obj` is not recognized as writable data.
