Interacting with UE4 Editor by commandline - best practice

Has there been update on this. I created a script but it works in the editor just find but when I try to run it headless it tends to crash.