class_docstr: A Handler that accepts a plain python function to use for modifying
  Bokeh Documents.
  
  For example, the following code configures a handler with a function that
  adds an empty plot to a Document:
  
  .. code-block:: python
  
      def add_empty_plot(doc: Document):
          p = figure(x_range=(0, 10), y_range=(0, 10))
          doc.add_root(p)
          return doc
  
      handler = FunctionHandler(add_empty_plot)
  
  This handler could be configured on an Application, and the Application
  would run this function every time a new session is created.
docstr: Execute the configured ``func`` to modify the document.
  
  After this method is first executed, ``safe_to_fork`` will return
  ``False``.
docstr_tok: ["Execute","the","configured","``","func","``","to","modify","the","document",".","After","this","method","is","first","executed",",","``","safe_to_fork","``","will","return","``","False","``","."]
code: def modify_document(self, doc: Document) -> None:
      """Execute the configured ``func`` to modify the document.
  
      After this method is first executed, ``safe_to_fork`` will return
      ``False``.
  
      """
      try:
          self._func(doc)
      except Exception as e:
          if self._trap_exceptions:
              handle_exception(self, e)
          else:
              raise
      finally:
          self._safe_to_fork = False
  
file_path: bokeh/src/bokeh/application/handlers/function.py
imports: from __future__ import annotations
  import logging
  from typing import Callable
  from ...document import Document
  from ...util.callback_manager import _check_callback
  from .handler import Handler, handle_exception
label_desc: Use image node_id 3 for calling the FunctionHandler obj's underlying member method code with example usage: obj.modify_document(doc) without return types