code: def test_plots_modify_existing_template(
      tmp_dir, dvc, run_copy_metrics, custom_template
  ):
      metric = [{"a": 1, "b": 2}, {"a": 2, "b": 3}]
      (tmp_dir / "metric_t.json").dump_json(metric, sort_keys=True)
      stage = run_copy_metrics(
          "metric_t.json",
          "metric.json",
          plots_no_cache=["metric.json"],
          name="copy-metrics",
          single_stage=False,
      )
      dvc.plots.modify(
          "metric.json", props={"template": relpath(custom_template)}
      )
      stage = stage.reload()
      assert stage.outs[0].plot == {
          "template": relpath(custom_template)
      }
  
file_path: dvc/tests/func/plots/test_modify.py
imports: import pytest
  from dvc.dvcfile import LOCK_FILE
  from dvc.repo.plots import PropsNotFoundError
  from dvc.utils import relpath
  from tests.utils.plots import get_plot
label_desc: Use image node_id 1 for calling a global function with example usage: test_plots_modify_existing_template(tmp_dir, dvc, run_copy_metrics, custom_template) without return types