Skip to main content

in_modelbit

Used to determine if the current Python execution context is running within Modelbit or not.

Returns True when called in a deployment or training job, and False when called in a notebook or Python script.

Example

To only execute some code if running in Modelbit:

import modelbit as mb

if mb.in_modelbit():
# this code only runs in deployments and training jobs

Likewise, to only execute some code when not in a deployment or training job:

import modelbit as mb

if not mb.in_modelbit():
# this code only runs in notebooks and Python scripts

See also