Programatically indicate that I want a HCL output instead of cdktf synth --hcl

I am new to cdktf and I am trying to implement it in a fastAPI project (Python).

Having a HCL output via the command “cdktf synth --hcl” is a major benefit for my project.

Instead of typing “cdktf synth --hcl” then “cdktf deploy” , I want my program to :
create an app,
create a stack,
add resources,
then via app.synth() create the output files in the HCL format ( not JSON)
then do a terraform apply via : subprocess.Popen( terraform apply the_generated_file)

I tried to do :
app(hcl_output=True)
While a cdk.tf file is indeed created , its content is a malformed JSON.

Thank you for you help in advance.