blendersynth.run.run_this_script

Quick utility to run the current script from Blender

blendersynth.run.run_this_script.is_blender_running()[source]

Returns True if blender is running, False otherwise

blendersynth.run.run_this_script.is_from_run_this_script()[source]

Returns True if this script is being run from run_this_script

blendersynth.run.run_this_script.run_this_script(*args, open_blender=False, debug=False, IDE='PyCharm', port=5678, host='localhost', blend_src=None, blend_as_copy=False, **kwargs)[source]

Run the script in which this function is called from Blender.

Parameters:
  • open_blender (bool) – If True, open a Blender instance after all code is executed, otherwise run in background

  • debug (bool) – If True, will run in debug mode

  • IDE (str) – IDE to use for debugging. Currently only PyCharm and VSCode are supported

  • port (int) – Port to use for debugging

  • host (str) – Host to use for debugging

  • blend_src (str) – Path to blend file to open (note: this is preferable to blendersynth.load_blend as it handles context better)

  • blend_as_copy (bool) – If True, will copy blend_src to a temp file before opening - this is useful if you want to make sure you don’t accidentally override your blend_src file

args & kwargs are passed to the script being run as command line arguments.

The flag –run_this_script is passed to the script being run to indicate that it is being run from run_this_script. Use function is_from_run_this_script to check if the script is being run from run_this_script.