I made it as a stand alone script. But both ways are fine