I'm using the script provided to open a new file and trying to insert a block onto it. Although, I have two problems. One, the block will only be inserted into a previously open document. The second is - provided there are no open documents - the block insertion script will not recognize the newly open file and crash the whole program.
My question is, what sort of function can I use to update the insertion script to the new file or vice versa? Would this be an embebbed function within the QCAD program?