class_docstr: Execute a JavaScript function.
  
  .. warning::
      The explicit purpose of this Bokeh Model is to embed *raw JavaScript
      code* for a browser to execute. If any part of the code is derived
      from untrusted user inputs, then you must take appropriate care to
      sanitize the user input prior to passing to Bokeh.
docstr: Construct a ``CustomJS`` instance from a ``*.js`` or ``*.mjs`` file.
  
  For example, if we want to construct a ``CustomJS`` instance from
  a JavaScript module ``my_module.mjs``, that takes a single argument
  ``source``, then we would use:
  
  .. code-block: python
  
      from bokeh.models import ColumnDataSource, CustomJS
      source = ColumnDataSource(data=dict(x=[1, 2, 3]))
      CustomJS.from_file("./my_module.mjs", source=source)
docstr_tok: ["Construct","a","``","CustomJS","``","instance","from","a","``","*",".js","``","or","``","*",".mjs","``","file",".","For","example",",","if","we","want","to","construct","a","``","CustomJS","``","instance","from","a","JavaScript","module","``","my_module.mjs","``",",","that","takes","a","single","argument","``","source","``",",","then","we","would","use",":","..","code-block",":","python","from","bokeh.models","import","ColumnDataSource",",","CustomJS","source","=","ColumnDataSource","(","data=dict","(","x=","[","1",",","2",",","3","]",")",")","CustomJS.from_file","(","``",".\/my_module.mjs","''",",","source=source",")"]
code: def from_file(cls, path: PathLike, **args: any) -> CustomJS:
      """
      Construct a ``CustomJS`` instance from a ``*.js`` or ``*.mjs`` file.
  
      For example, if we want to construct a ``CustomJS`` instance from
      a JavaScript module ``my_module.mjs``, that takes a single argument
      ``source``, then we would use:
  
      .. code-block: python
  
          from bokeh.models import ColumnDataSource, CustomJS
          source = ColumnDataSource(data=dict(x=[1, 2, 3]))
          CustomJS.from_file("./my_module.mjs", source=source)
  
      """
      path = pathlib.Path(path)
  
      if path.suffix == ".js":
          module = False
      elif path.suffix == ".mjs":
          module = True
      else:
          raise RuntimeError(
              f"expected a *.js or *.mjs file, got {path}"
          )
  
      with open(path, encoding="utf-8") as file:
          code = file.read()
  
      return CustomJS(code=code, args=args, module=module)
  
imports: from __future__ import annotations
  import logging
  import pathlib
  from typing import TYPE_CHECKING, Any
  from ..core.has_props import HasProps, abstract
  from ..core.properties import Any, AnyRef, Auto, Bool, Dict, Either, Instance, Required, String
  from ..core.property.bases import Init
  from ..core.property.singletons import Intrinsic
  from ..core.validation import error
  from ..core.validation.errors import INVALID_PROPERTY_VALUE, NOT_A_PROPERTY_OF
  from ..model import Model
label_desc: Use image node_id 2 for calling the CustomJS obj's underlying member method code with example usage: obj.from_file(cls, path) and returns: CustomJS