You never said you wanted the DWGs importing so each went into a separate SKP file !
๐
To do that you need a bit more code - start with an almost empty SKP add a small bit of geometry [dot at origin?] to force a new component on import; run the adjusted code, it gets the imported file name and imports it, saves the SKP with that name.skpe [into a given folder], then it erases the DWG-component and purges the SKP's definitions, and adds the next DWG and repeats saving as that name etc... until all DWGs should have been saved into separate SKPs...