code: def updateFunction(old, new, debug, depth=0, visited=None):
      # if debug and depth > 0:
      # print "    -> also updating previous version", old, " -> ", new
  
      old.__code__ = new.__code__
      old.__defaults__ = new.__defaults__
      if hasattr(old, "__kwdefaults"):
          old.__kwdefaults__ = new.__kwdefaults__
      old.__doc__ = new.__doc__
  
      if visited is None:
          visited = []
      if old in visited:
          return
      visited.append(old)
  
      ## finally, update any previous versions still hanging around..
      if hasattr(old, "__previous_reload_version__"):
          maxDepth = updateFunction(
              old.__previous_reload_version__,
              new,
              debug,
              depth=depth + 1,
              visited=visited,
          )
      else:
          maxDepth = depth
  
      ## We need to keep a pointer to the previous version so we remember to update BOTH
      ## when the next reload comes around.
      if depth == 0:
          new.__previous_reload_version__ = old
      return maxDepth
  
file_path: pyqtgraph/pyqtgraph/reload.py
imports: from __future__ import print_function
  import gc
  import inspect
  import os
  import sys
  import traceback
  import types
  from .debug import printExc
label_desc: Use image node_id 3 for calling a global function with example usage: updateFunction(old, new, debug, depth, visited) and returns: maxDepth