diff --git a/openpype/hosts/nuke/api/lib.py b/openpype/hosts/nuke/api/lib.py index 4a57bc3165..c469612954 100644 --- a/openpype/hosts/nuke/api/lib.py +++ b/openpype/hosts/nuke/api/lib.py @@ -3116,3 +3116,12 @@ def get_viewer_config_from_string(input_string): ).format(input_string)) return (display, viewer) + + +def is_headless(): + """ + Returns: + bool: headless + """ + headless = QtWidgets.QApplication.instance() is None + return headless diff --git a/openpype/hosts/nuke/api/workio.py b/openpype/hosts/nuke/api/workio.py index 032a9fdda8..8b5bae3b2c 100644 --- a/openpype/hosts/nuke/api/workio.py +++ b/openpype/hosts/nuke/api/workio.py @@ -2,6 +2,7 @@ import os import nuke from qtpy import QtWidgets +from openpype.hosts.nuke.api.lib import is_headless def file_extensions(): @@ -26,7 +27,7 @@ def open_file(filepath): # To remain in the same window, we have to clear the script and read # in the contents of the workfile. nuke.scriptClear() - headless = QtWidgets.QApplication.instance() is None + headless = is_headless() if not headless: autosave = nuke.toNode("preferences")["AutoSaveName"].evaluate() autosave_prmpt = "Autosave detected.\nWould you like to load the autosave file?" # noqa