docstr: The |Document| this model is attached to (can be ``None``)
  
          
docstr_tok: ["The","|Document|","this","model","is","attached","to","(","can","be","``","None","``",")"]
code: def document(self) -> Document | None:
      """The |Document| this model is attached to (can be ``None``)"""
      if self._temp_document is not None:
          return self._temp_document
      return self._document
  
file_path: bokeh/src/bokeh/model/util.py
imports: from __future__ import annotations
  import logging
  from typing import TYPE_CHECKING, Any, Callable
  from ..core.has_props import HasProps, Qualified
  from ..util.dataclasses import entries, is_dataclass
label_desc: Use image node_id 2 for calling the HasDocumentRef obj's underlying member method code with example usage: obj.document() and returns: self, self