export audio selection as flac?

hello, I have a python script that will export a selection of audio as an mp3 file using the ‘Export2’ function, is there a way to export the audio file as flac instead? I can do this regularly using the audacity export menu, is there any export function that would allow me to do this, or some way to programatically navigate through the audacity menus? Thanks

I’m currently testing Audacity 2.4.0 alpha.
If I use Export2 and supply a name that has the file extension “.flac”, then a FLAC file is exported.
I’ve not tested with 2.3.3.