Myelination of axons by oligodendrocytes is a key feature of the remarkably fast operating CNS. Oligodendrocytes not only tune axonal conduction speed but are also suggested to maintain long-term axonal integrity by providing metabolic support to the axons they ensheath. However, how myelinating oligodendrocytes impact axonal energy homeostasis remains poorly understood and difficult to investigate. Here, we provide a method of how to study electrically active myelinated axons expressing genetically encoded sensors by combining electrophysiology and two-photon imaging of acutely isolated optic nerves. We show that intravitreal adeno-associated viral (AAV) vector delivery is an efficient tool to achieve functional sensor expression in optic nerve axons, which is demonstrated by measuring axonal ATP dynamics following AAV-mediated sensor expression. This novel approach allows for fast expression of any optical sensor of interest to be studied in optic nerve axons without the need to go through the laborious process of producing new transgenic mouse lines. Viral-mediated biosensor expression in myelinated axons and the subsequent combination of nerve recordings and sensor imaging outlines a powerful method to investigate oligodendroglial support functions and to further interrogate cellular mechanisms governing axonal energy homeostasis under physiological and pathological conditions.