add debug flag for PYLayer and PYView