Import sgtk in a subprocess from maya

Hi I’m doing some subprocess from maya to shuffle some time-consuming task into a separate process. The subprocess is basically Popen([‘python’, ‘script.py’]). But it throw error in the very beginning of the script.py

File "C:\Users\stzhang\PycharmProjects\script.py", line 26, in <module>
    import sgtk
  File "C:\Users\stzhang\AppData\Roaming\Shotgun\p255c133.basic.desktop\cfg\install\core\python\sgtk\__init__.py", line 16, in <module>
    import tank
  File "C:\Users\stzhang\AppData\Roaming\Shotgun\p255c133.basic.desktop\cfg\install\core\python\tank\__init__.py", line 110, in <module>
    from . import authentication
  File "C:\Users\stzhang\AppData\Roaming\Shotgun\p255c133.basic.desktop\cfg\install\core\python\tank\authentication\__init__.py", line 35, in <module>
    from .shotgun_authenticator import ShotgunAuthenticator
  File "C:\Users\stzhang\AppData\Roaming\Shotgun\p255c133.basic.desktop\cfg\install\core\python\tank\authentication\shotgun_authenticator.py", line 13, in <module>
    from .sso_saml2 import has_sso_info_in_cookies, has_unified_login_flow_info_in_cookies
  File "C:\Users\stzhang\AppData\Roaming\Shotgun\p255c133.basic.desktop\cfg\install\core\python\tank\authentication\sso_saml2\__init__.py", line 15, in <module>
    from .core.errors import (  # noqa
  File "C:\Users\stzhang\AppData\Roaming\Shotgun\p255c133.basic.desktop\cfg\install\core\python\tank\authentication\sso_saml2\core\__init__.py", line 15, in <module>
    from .sso_saml2_core import SsoSaml2Core  # noqa
  File "C:\Users\stzhang\AppData\Roaming\Shotgun\p255c133.basic.desktop\cfg\install\core\python\tank\authentication\sso_saml2\core\sso_saml2_core.py", line 46, in <module>
    from .username_password_dialog import UsernamePasswordDialog
  File "C:\Users\stzhang\AppData\Roaming\Shotgun\p255c133.basic.desktop\cfg\install\core\python\tank\authentication\sso_saml2\core\username_password_dialog.py", line 17, in <module>
    from ...ui.qt_abstraction import QtCore, QtGui
  File "C:\Users\stzhang\AppData\Roaming\Shotgun\p255c133.basic.desktop\cfg\install\core\python\tank\authentication\ui\qt_abstraction.py", line 22, in <module>
    QtWebEngineWidgets = _importer.QtWebEngineWidgets
  File "C:\Users\stzhang\AppData\Roaming\Shotgun\p255c133.basic.desktop\cfg\install\core\python\tank\util\qt_importer.py", line 86, in QtWebEngineWidgets
    return self._modules["QtWebEngineWidgets"] if self._modules else None
KeyError: 'QtWebEngineWidgets'

Before importing sgtk, print out your sys.path and PYTHONPATH and check which path sgtk will be getting imported from.
You probably want to explicitly set your centrally installed tk-core path before importing sgtk.
Eg

import sys
sys.path.insert(0,"path-to-tk-core/python")
import sgtk