> ## Documentation Index
> Fetch the complete documentation index at: https://docs.wandb.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# How do I log an artifact to an existing run?

Sometimes you need to mark an artifact as the output of a previously logged run. For example, you might generate a new model checkpoint or dataset that should be associated with an earlier training run. The following code reinitializes a run by ID and logs a new artifact to it:

```python theme={null}
with wandb.init(id="existing_run_id", resume="allow") as run:
    artifact = wandb.Artifact("artifact_name", "artifact_type")
    artifact.add_file("my_data/file.txt")
    run.log_artifact(artifact)
```

***

<Badge stroke shape="pill" color="orange" size="md">[Artifacts](/support/models/tags/artifacts)</Badge>
