code: def watch_dir(
      path: str,
      on_dir_changed: Callable[[str], None],
      watcher_type: Optional[str] = None,
      *,  # keyword-only arguments:
      glob_pattern: Optional[str] = None,
      allow_nonexistent: bool = False,
  ) -> bool:
      return _watch_path(
          path,
          on_dir_changed,
          watcher_type,
          glob_pattern=glob_pattern,
          allow_nonexistent=allow_nonexistent,
      )
  
file_path: streamlit/lib/streamlit/watcher/path_watcher.py
imports: from typing import Callable, Optional, Type, Union
  import click
  import streamlit.watcher
  from streamlit import config, env_util
  from streamlit.logger import get_logger
  from streamlit.watcher.polling_path_watcher import PollingPathWatcher
label_desc: Use image node_id 4 for calling a global function with example usage: watch_dir(path, on_dir_changed, watcher_type) and returns: _watch_path