code: def test_task_spawn_detached_actor_spawn_actor(shutdown_only):
      @ray.remote
      def spawn_detached_actor():
          assert ray._private.worker.global_worker.task_depth == 1
  
          nested_actor = NestedActor.options(
              name="detached", lifetime="detached"
          ).remote(expected_depth=2)
          ray.get(
              nested_actor.run_actor_task.remote(
                  max_depth=3, spawn_task=False, expected_depth=2
              )
          )
  
      ray.get(spawn_detached_actor.remote())
  
file_path: ray/python/ray/tests/test_nested_task.py
imports: import sys
  import threading
  import pytest
  import ray
label_desc: Use image node_id 6 for calling a global function with example usage: test_task_spawn_detached_actor_spawn_actor(shutdown_only) without return types