if thisTrial != None:
        for paramName in thisTrial.keys():
            exec (paramName + "= thisTrial." + paramName)

    # ------Prepare to start Routine "trial"-------
    t = 0
    trialClock.reset()  # clock
    frameN = -1
    # update component parameters for each repeat
    trial_question_txt.setText(T_TEXT)
    trial_image.setImage(T_IMG)

    # >>> iohub Custom Code
    pen_traces_stim.clear()
    pen_traces_stim.setAutoDraw(False)
    pen_traces_stim.status = NOT_STARTED

    io.clearEvents()
    print "STarting TRIAL:", pen_traces_stim.status == NOT_STARTED, pen_traces_stim.status
    print "trial_question_txt:", trial_question_txt.depth
    print "trial_image:", trial_image.depth
    print "trial_end_image:", trial_end_image.depth
    print "penDotStim:", penDotStim.depth

    penDotOpacity = 0
    penDotPosition = [0, 0]
    penDotColor = [1, 0, 0]

    tablet.reporting = True
    # <<< iohub Custom Code