code: def reload(module, debug=False, lists=False, dicts=False):
      """Replacement for the builtin reload function:
      - Reloads the module as usual
      - Updates all old functions and class methods to use the new code
      - Updates all instances of each modified class to use the new class
      - Can update lists and dicts, but this is disabled by default
      - Requires that class and function names have not changed
      """
      if debug:
          print("Reloading %s" % str(module))
  
      ## make a copy of the old module dictionary, reload, then grab the new module dictionary for comparison
      oldDict = module.__dict__.copy()
      orig_reload(module)
      newDict = module.__dict__
  
      ## Allow modules access to the old dictionary after they reload
      if hasattr(module, "__reload__"):
          module.__reload__(oldDict)
  
      ## compare old and new elements from each dict; update where appropriate
      for k in oldDict:
          old = oldDict[k]
          new = newDict.get(k, None)
          if old is new or new is None:
              continue
  
          if inspect.isclass(old):
              if debug:
                  print(
                      "  Updating class %s.%s (0x%x -> 0x%x)"
                      % (module.__name__, k, id(old), id(new))
                  )
              updateClass(old, new, debug)
              # don't put this inside updateClass because it is reentrant.
              new.__previous_reload_version__ = old
  
          elif inspect.isfunction(old):
              depth = updateFunction(old, new, debug)
              if debug:
                  extra = ""
                  if depth > 0:
                      extra = " (and %d previous versions)" % depth
                  print(
                      "  Updating function %s.%s%s"
                      % (module.__name__, k, extra)
                  )
          elif lists and isinstance(old, list):
              l = old.len()
              old.extend(new)
              for i in range(l):
                  old.pop(0)
          elif dicts and isinstance(old, dict):
              old.update(new)
              for j in old:
                  if j not in new:
                      del old[j]
  
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 2 for calling a global function with example usage: reload(module, debug, lists, dicts) without return types