docstr: Interacts with a function by making Parameters for each argument.
  
  There are several potential use cases and argument handling possibilities
  depending on which values are passed to this function, so a more detailed
  explanation of several use cases is provided in the "Interactive Parameters" doc.
  
  if any non-defaults exist, a value must be provided for them in ``overrides``. If
  this value should *not* be made into a parameter, include its name in ``ignores``.
  
  Parameters
  ----------
  function: Callable
      function with which to interact. Can also be a :class:`InteractiveFunction`,
      if a reference to the bound signals is required.
  runOptions: ``GroupParameter.<RUN_ACTION, CHANGED, or CHANGING>`` value
      How the function should be run, i.e. when pressing an action, on
      sigValueChanged, and/or on sigValueChanging
  ignores: Sequence
      Names of function arguments which shouldn't have parameters created
  parent: GroupParameter
      Parent in which to add argument Parameters. If *None*, a new group
      parameter is created.
  titleFormat: str or Callable
      title of the group sub-parameter if one must be created (see ``nest``
      behavior). If a function is supplied, it must be of the form (str) -> str
      and will be passed the function name as an input
  nest: bool
      If *True*, the interacted function is given its own GroupParameter,
      and arguments to that function are 'nested' inside as its children.
      If *False*, function arguments are directly added to this parameter
      instead of being placed inside a child GroupParameter
  runActionTemplate: dict
      Template for the action parameter which runs the function, used
      if ``runOptions`` is set to ``GroupParameter.RUN_ACTION``. Note that
      if keys like "name" or "type" are not included, they are inferred
      from the previous / default ``runActionTemplate``. This allows
      items that should only be set per-function to exist here, like
      a ``shortcut`` or ``icon``.
  existOk: bool
      Whether it is OK for existing parameter names to bind to this function.
      See behavior during 'Parameter.insertChild'
  overrides:
      Override descriptions to provide additional parameter options for each
      argument. Moreover, extra parameters can be defined here if the original
      function uses ``**`` to consume additional keyword arguments. Each
      override can be a value (e.g. 5) or a dict specification of a
      parameter (e.g. dict(type='list', limits=[0, 10, 20]))
docstr_tok: ["Interacts","with","a","function","by","making","Parameters","for","each","argument",".","There","are","several","potential","use","cases","and","argument","handling","possibilities","depending","on","which","values","are","passed","to","this","function",",","so","a","more","detailed","explanation","of","several","use","cases","is","provided","in","the","``","Interactive","Parameters","''","doc",".","if","any","non-defaults","exist",",","a","value","must","be","provided","for","them","in","``","overrides","``",".","If","this","value","should","*","not","*","be","made","into","a","parameter",",","include","its","name","in","``","ignores","``",".","Parameters","--","--","--","--","--","function",":","Callable","function","with","which","to","interact",".","Can","also","be","a",":","class",":","`","InteractiveFunction","`",",","if","a","reference","to","the","bound","signals","is","required",".","runOptions",":","``","GroupParameter.","<","RUN_ACTION",",","CHANGED",",","or","CHANGING",">","``","value","How","the","function","should","be","run",",","i.e",".","when","pressing","an","action",",","on","sigValueChanged",",","and\/or","on","sigValueChanging","ignores",":","Sequence","Names","of","function","arguments","which","should","n't","have","parameters","created","parent",":","GroupParameter","Parent","in","which","to","add","argument","Parameters",".","If","*","None","*",",","a","new","group","parameter","is","created",".","titleFormat",":","str","or","Callable","title","of","the","group","sub-parameter","if","one","must","be","created","(","see","``","nest","``","behavior",")",".","If","a","function","is","supplied",",","it","must","be","of","the","form","(","str",")","-",">","str","and","will","be","passed","the","function","name","as","an","input","nest",":","bool","If","*","True","*",",","the","interacted","function","is","given","its","own","GroupParameter",",","and","arguments","to","that","function","are","'nested","'","inside","as","its","children",".","If","*","False","*",",","function","arguments","are","directly","added","to","this","parameter","instead","of","being","placed","inside","a","child","GroupParameter","runActionTemplate",":","dict","Template","for","the","action","parameter","which","runs","the","function",",","used","if","``","runOptions","``","is","set","to","``","GroupParameter.RUN_ACTION","``",".","Note","that","if","keys","like","``","name","''","or","``","type","''","are","not","included",",","they","are","inferred","from","the","previous","\/","default","``","runActionTemplate","``",".","This","allows","items","that","should","only","be","set","per-function","to","exist","here",",","like","a","``","shortcut","``","or","``","icon","``",".","existOk",":","bool","Whether","it","is","OK","for","existing","parameter","names","to","bind","to","this","function",".","See","behavior","during","'Parameter.insertChild'","overrides",":","Override","descriptions","to","provide","additional","parameter","options","for","each","argument",".","Moreover",",","extra","parameters","can","be","defined","here","if","the","original","function","uses","``","*","*","``","to","consume","additional","keyword","arguments",".","Each","override","can","be","a","value","(","e.g",".","5",")","or","a","dict","specification","of","a","parameter","(","e.g",".","dict","(","type='list","'",",","limits=","[","0",",","10",",","20","]",")",")"]
code: def interact(
      self,
      function,
      *,
      ignores=None,
      runOptions=PARAM_UNSET,
      parent=PARAM_UNSET,
      titleFormat=PARAM_UNSET,
      nest=PARAM_UNSET,
      runActionTemplate=PARAM_UNSET,
      existOk=PARAM_UNSET,
      **overrides,
  ):
      """
      Interacts with a function by making Parameters for each argument.
  
      There are several potential use cases and argument handling possibilities
      depending on which values are passed to this function, so a more detailed
      explanation of several use cases is provided in the "Interactive Parameters" doc.
  
      if any non-defaults exist, a value must be provided for them in ``overrides``. If
      this value should *not* be made into a parameter, include its name in ``ignores``.
  
      Parameters
      ----------
      function: Callable
          function with which to interact. Can also be a :class:`InteractiveFunction`,
          if a reference to the bound signals is required.
      runOptions: ``GroupParameter.<RUN_ACTION, CHANGED, or CHANGING>`` value
          How the function should be run, i.e. when pressing an action, on
          sigValueChanged, and/or on sigValueChanging
      ignores: Sequence
          Names of function arguments which shouldn't have parameters created
      parent: GroupParameter
          Parent in which to add argument Parameters. If *None*, a new group
          parameter is created.
      titleFormat: str or Callable
          title of the group sub-parameter if one must be created (see ``nest``
          behavior). If a function is supplied, it must be of the form (str) -> str
          and will be passed the function name as an input
      nest: bool
          If *True*, the interacted function is given its own GroupParameter,
          and arguments to that function are 'nested' inside as its children.
          If *False*, function arguments are directly added to this parameter
          instead of being placed inside a child GroupParameter
      runActionTemplate: dict
          Template for the action parameter which runs the function, used
          if ``runOptions`` is set to ``GroupParameter.RUN_ACTION``. Note that
          if keys like "name" or "type" are not included, they are inferred
          from the previous / default ``runActionTemplate``. This allows
          items that should only be set per-function to exist here, like
          a ``shortcut`` or ``icon``.
      existOk: bool
          Whether it is OK for existing parameter names to bind to this function.
          See behavior during 'Parameter.insertChild'
      overrides:
          Override descriptions to provide additional parameter options for each
          argument. Moreover, extra parameters can be defined here if the original
          function uses ``**`` to consume additional keyword arguments. Each
          override can be a value (e.g. 5) or a dict specification of a
          parameter (e.g. dict(type='list', limits=[0, 10, 20]))
      """
      # Special case: runActionTemplate can be overridden to specify action
      if runActionTemplate is not PARAM_UNSET:
          runActionTemplate = {
              **self.runActionTemplate,
              **runActionTemplate,
          }
      # Get every overridden default
      locs = locals()
      # Everything until action template
      opts = {
          kk: locs[kk]
          for kk in self._optionNames
          if locs[kk] is not PARAM_UNSET
      }
      oldOpts = self.setOpts(**opts)
      # Delete explicitly since correct values are now ``self`` attributes
      del (
          runOptions,
          titleFormat,
          nest,
          existOk,
          parent,
          runActionTemplate,
      )
  
      function = self._toInteractiveFunction(function)
      funcDict = self.functionToParameterDict(
          function.function, **overrides
      )
      children = funcDict.pop("children", [])  # type: list[dict]
      chNames = [ch["name"] for ch in children]
      funcGroup = self._resolveFunctionGroup(funcDict, function)
  
      # Values can't come both from closures and overrides/params, so ensure they don't
      # get created
      if ignores is None:
          ignores = []
      ignores = list(ignores) + list(function.closures)
  
      # Recycle ignored content that is needed as a value
      recycleNames = set(ignores) & set(chNames)
      for name in recycleNames:
          value = children[chNames.index(name)]["value"]
          if name not in function.extra and value is not PARAM_UNSET:
              function.extra[name] = value
  
      missingChildren = [
          ch["name"]
          for ch in children
          if ch["value"] is PARAM_UNSET
          and ch["name"] not in function.closures
          and ch["name"] not in function.extra
      ]
      if missingChildren:
          # setOpts will not be called due to the value error, so reset here.
          # This only matters to restore Interactor state in an outer try-except
          # block
          self.setOpts(**oldOpts)
          raise ValueError(
              f"Cannot interact with `{function}` since it has required parameters "
              f"{missingChildren} with no default or closure values provided."
          )
  
      useParams = []
      checkNames = [n for n in chNames if n not in ignores]
      for name in checkNames:
          childOpts = children[chNames.index(name)]
          child = self.resolveAndHookupParameterChild(
              funcGroup, childOpts, function
          )
          if child is not None:
              useParams.append(child)
  
      function.hookupParameters(useParams)
      if RunOptions.ON_ACTION in self.runOptions:
          # Add an extra action child which can activate the function
          action = self._resolveRunAction(
              function, funcGroup, funcDict.get("tip")
          )
          if action:
              useParams.append(action)
      retValue = funcGroup if self.nest else useParams
      self.setOpts(**oldOpts)
      # Return either the parent which contains all added options, or the list
      # of created children (if no parent was created)
      return retValue
  
imports: import contextlib
  import functools
  import inspect
  import pydoc
  from .None import Parameter
  from .parameterTypes import ActionGroupParameter
  from ..None import functions
label_desc: Use image node_id 4 for calling the Interactor obj's underlying member method code with example usage: obj.interact(function) and returns: retValue