Maya 2016 - Subprocess Issue

I have not completely migrated from Maya 2016 to Maya 2017. I still need to do some processing through Maya 2016 because of some dependencies on legacy stuff. I want to initialize Maya2016 in the background to process some file all the while I’m working in Maya2017. So my thought process is have Maya2017’s calling Maya2016’s interpreter (maya2016->mayapy.exe) as a subprocess to run some task. When I do so I get this error is thrown:

File “S:\Maya_2016_DI\build\Release\runTime\Python\Lib\site-packages\maya\Open
Maya.py”, line 25, in
File “S:\Maya_2016_DI\build\Release\runTime\Python\Lib\site-packages\maya\Open
Maya.py”, line 21, in swig_import_helper
ImportError: DLL load failed: The specified module could not be found.

Can anyone shed some light on this? Or am I going at this the wrong way?

Thanks.

I believe subprocess passes the current environment to the launched application, which could easily cause the new interpreter to be looking at the 2017 libraries and modules.
You could try copying the current environment, and replacing any of the references to 2017 with 2016 and initialize the new process with that environment.

Shows a simple example:

Thanks! I’ll give that a shot.