You can use the python module of the environment manager.
import psse_env_manager
import os
psse_version = 34
src1 = 'model.f90'
modsources = ['module.f90']
dllname = 'dsusr.dll'
workdir = os.getcwd()
ivf_version = '19'
psse_env_manager.create_dll(psse_version, src1, modsources=modsources, dllname=dllname,
workdir=workdir, showprg=True, useivfvrsn=ivf_version, shortname='DSUSR',
description='description', majorversion=1, minorversion=0, buildversion=0, companyname='',
mypathlib=False)
However, you will also need visual studio build tools to actually build the dll. This is the problematic part for me since psse_env_manager will not recognize my visual studio 2017 Installation when I import the module like above.
The error in my case is something like <"\vswhere.exe" file not found>
I don't know why this happens in my case and why there is that strange backslash in front of the file path.
I still hope it works for you.