Skip to content

Runtime bootstrap

Load gmatpy for a resolved GmatInstall. bootstrap takes the install, ensures the API startup file exists (generating it on first use), prepends the install's bin/ to sys.path, imports gmatpy, calls gmat.Setup(...), and returns the imported module.

Mission.load calls bootstrap for you. Reach for it directly only if you are driving GMAT outside the Mission abstraction.

bootstrap is idempotent within a single interpreter, but a second call requesting a different install raises GmatLoadError — see Known limitations → gmatpy single-init constraint.

bootstrap

bootstrap(install: GmatInstall) -> ModuleType

Load gmatpy for install and return the imported module.

On first call: ensures <install.bin_dir>/api_startup_file.txt exists (generating it via <install.api_dir>/BuildApiStartupFile.py if missing), prepends the bin directory to :data:sys.path, imports gmatpy, and calls gmatpy.Setup(...) on the API startup file.

Subsequent calls with the same install return the cached module handle. Calls with a different install raise — gmatpy cannot be reinitialised.

Raises:

Type Description
GmatLoadError

gmatpy could not be imported for this install, the API startup file could not be generated, or a second install was requested.