@christopher_hermansson -San.
Sorry, I made a mistake.
In the following sample, you can toggle the "Show Constraints" on the screen.
# Fusion360API Python script
import traceback
import adsk.core as core
import adsk.fusion as fusion
def run(context):
ui: core.UserInterface = None
try:
app: core.Application = core.Application.get()
ui = app.userInterface
des: fusion.Design = app.activeProduct
skt: fusion.Sketch = fusion.Sketch.cast(des.activeEditObject)
if not skt: return
skt.areConstraintsShown = not skt.areConstraintsShown
ui.messageBox("Done")
except:
if ui:
ui.messageBox('Failed:\n{}'.format(traceback.format_exc()))
However, the Sketch Palette check was not linked.

Therefore, I modified it and used the text command.
・・・
# skt.areConstraintsShown = not skt.areConstraintsShown
txtCmd = u'Commands.SetBool show_constraints {}'.format(
0 if skt.areConstraintsShown else 1
)
app.executeTextCommand(txtCmd)
・・・
