The ``startup_code.py`` module ============================== .. py:module:: ansys.lumerical.mcp.startup_code Summary ------- .. py:currentmodule:: startup_code .. tab-set:: .. tab-item:: Constants .. list-table:: :header-rows: 0 :widths: auto * - :py:obj:`~LUMERICAL_STARTUP_CODE` - Description ----------- Bootstrap code fed into the framework's persistent Python subprocess. The framework's :class:`PersistentPythonSession` pipes startup code into a ``python -u -i`` stdin, whose line-oriented parser treats a blank line at column 0 as the end of a compound statement, so multi-line ``def``/``try`` blocks can't be sent directly. Instead, the real helpers live in the normal, lint-friendly :mod:`ansys.lumerical.mcp._subprocess_helpers` module. Its source is read, base64-encoded, and shipped as a two-line wrapper that decodes and executes it. (``exec`` parses the whole string as a module, so blank lines and docstrings work.) :mod:`_subprocess_helpers` is **never imported in this parent process**. Its source is only read via :mod:`importlib.resources`, keeping the parent free of its import-time side effects (``matplotlib.use('Agg')`` and the ``ansys.lumerical.core`` probe) and letting the subprocess run without ``ansys.lumerical.mcp`` installed (only built-in :mod:`base64` is needed). Seeded subprocess globals: ``FDTD``/``MODE``/``DEVICE``/``INTERCONNECT`` (from ``ansys.lumerical.core``), the ``_lumerical_sessions`` registry, and the ``_lum_*`` helpers. (See :mod:`ansys.lumerical.mcp._subprocess_helpers`.) .. !! processed by numpydoc !! Module detail ------------- .. py:data:: LUMERICAL_STARTUP_CODE