diff --git a/openpype/hosts/max/startup/startup.py b/openpype/hosts/max/startup/startup.py index 37bcef5db1..21da115baa 100644 --- a/openpype/hosts/max/startup/startup.py +++ b/openpype/hosts/max/startup/startup.py @@ -1,6 +1,20 @@ # -*- coding: utf-8 -*- -from openpype.hosts.max.api import MaxHost -from openpype.pipeline import install_host +import os +import sys + +# this might happen in some 3dsmax version where PYTHONPATH isn't added +# to sys.path automatically +try: + from openpype.hosts.max.api import MaxHost + from openpype.pipeline import install_host +except (ImportError, ModuleNotFoundError): + + for path in os.environ["PYTHONPATH"].split(os.pathsep): + if path and path not in sys.path: + sys.path.append(path) + + from openpype.hosts.max.api import MaxHost + from openpype.pipeline import install_host host = MaxHost() install_host(host)