 Flannery was elected as a Democrat to the Seventy-fifth, Seventy-sixth, and Seventy-seventh Congresses.He served from January 3, 1937, until his resignation on January 3, 1942, to become judge of the common pleas court of Luzerne County.He was reelected in 1951 for a ten-year term and served until his death in Bethesda, Maryland.