Programatically use "Specify Geometry" (Python)

found a good example about it here: