Mel FBX commands and mayapy

I’m trying to run some mel commands to load fbx presets and export a fbx from maya. I’m doing the work in a python script so that it can be batched by using mayapy. However, every time I run the script, it stops at the mel FBX command, stating that it cannot find the procedure. The error happens on all the mel FBX commands.

import maya.standalone as std
import maya.cmds as cmds
import maya.mel as mel

std.initialize(name='python')
exportFile = "C:/maya/fileToExport.ma"
        
cmds.file(exportFile,o=1,f=1)
fbxPresetPath = "E:/fbxpresets/TEST.fbxexportpreset"
fbxCommand = "FBXLoadExportPresetFile -f \"" + fbxPresetPath + "\""
mel.eval(fbxCommand)

In the command line I cycle to Maya’s bin drive and run: mayapy scriptToRun.py

I’m I just missing something stupid? It seems like it should work since it works on other mel commands, except FBX ones.

Thanks!

Figured it out. The plugins needed to be specifically loaded when running mayapy from commandline.

That plugin gets unloaded randomly! Could never figure out why…

Same problem here, from time to time FBX just unloads itself, anyone found out why?