There's a caveat: You must obtain the IR within a couple (few?) years of passing the ATPL theory or the theory credits lapse. Once an IR is gained the ATPL theory remains valid for 7 (?) years after the last the IR renewal. Not sure if there's a requirement to hold the CPL as well.
Your options are:
1. Do the CPL & IR theory (any order). Then the relevant training & flight tests for the CPL licence & for the IR. At some point return to the classroom to do the ATPL theory.
2. Do the ATPL theory. Then the relevent training & flight tests for the CPL & IR. Make damn sure you get the IR within the required period post-ATPL exams.