code: def activate(p, extra_network_data):
      """call activate for extra networks in extra_network_data in specified order, then call
      activate for all remaining registered networks with an empty argument list
      """
  
      activated = []
  
      for extra_network, extra_network_args in lookup_extra_networks(
          extra_network_data
      ).items():
          try:
              extra_network.activate(p, extra_network_args)
              activated.append(extra_network)
          except Exception as e:
              errors.display(
                  e,
                  f"activating extra network {extra_network.name} with arguments {extra_network_args}",
              )
  
      for (
          extra_network_name,
          extra_network,
      ) in extra_network_registry.items():
          if extra_network in activated:
              continue
  
          try:
              extra_network.activate(p, [])
          except Exception as e:
              errors.display(
                  e, f"activating extra network {extra_network_name}"
              )
  
      if p.scripts is not None:
          p.scripts.after_extra_networks_activate(
              p,
              batch_number=p.iteration,
              prompts=p.prompts,
              seeds=p.seeds,
              subseeds=p.subseeds,
              extra_network_data=extra_network_data,
          )
  
imports: import json
  import os
  import re
  import logging
  from collections import defaultdict
  from modules import errors
label_desc: Use image node_id 6 for calling a global function with example usage: activate(p, extra_network_data) without return types