‘By which’ is correct.
It is one of a range of prepositions used with ‘which’ to form prepositional structures.
Its meaning is the same as ‘in which’ but 'in which ’ usually relates to a place, rather than a mechanism.
Although use of ‘by which’ is not specifically mentioned, you may find this information useful.