Python Batch Mode Difference in GUI vs no-GUI

Altair Community Member
Updated by William Kuo_21386
When I run my python script in batch mode through the console, it crashes when I use import hm
. It works fine when I run it through the python console in GUI. Why is there this discrepancy?
Code that doesn't output anything when I check it through batch_log.txt:

Code that works when I check it through batch_log.txt:

What batch_log.txt says when it works:

The command I run:
runhwx.exe -client HyperWorksDesktop -plugin HyperworksLauncher -profile HyperworksLauncher -l en -startwith HyperMesh -b -f C:\hypermesh_batch_test.py