Hi @jamalm and welcome to Pyblish!
Yes, that should be trivial. Simply make a Python script and call it from mayapy
publish_from_mayapy.py
from maya import standalone
standalone.initialize()
import pyblish_qml
pyblish_qml.show()
Then from Maya, you can call it as such.
From Maya
import subprocess
subprocess.Popen([
"/absolute/path/to/mayapy",
"/absolute/path/to/publish_from_mayapy.py"
])
This should open a new console window, where Pyblish (mayapy) will start outputting messages, like you would normally see in Maya Script Editor when running from the same process.
Once you’ve got that running, you might want to pass the current scene file to it.
publish_from_mayapy.py
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("scenefile")
args = parser.parse_args()
from maya import standalone, cmds
standalone.initialize()
cmds.file(args.scenefile, open=True, force=True)
import pyblish_qml
pyblish_qml.show()
To call this, you’d probably save your scene, and pass the path to it as an argument.
From Maya
import subprocess
from maya import cmds
cmds.file(save=True)
scenefile = cmds.file(sceneName=True, query=True)
subprocess.Popen([
"/absolute/path/to/mayapy",
"/absolute/path/to/publish_from_mayapy.py",
scenefile
])
I just typed this up as I went and haven’t actually run it (so beware), but also let me know if something doesn’t work as I’d described, and we’ll get to the bottom of it. Short answer at least is that yes, it’s possible!