Can i run my cables from the outside box to the inside breaker box through 2x4 studs?
National Electric Code calls for protection of the cable or raceway (conduit).
National Electric Code (NEC)

300.4 Protection Against Physical Damage. Where subject to physical damage, conductors shall be protected.
(A) Cables and Raceways Through Wood Members.
(1) Bored Holes. In both exposed and concealed locations, where a cable or raceway type wiring method is installed through bored holes
in joists, rafters, or wood members, holes shall be bored so that the
edge of the hole is not less than 32 mm (11⁄4 in.) from the nearest
edge of the wood member. Where this distance cannot be maintained, the
cable or raceway shall be protected from penetration by screws or
nails by a steel plate(s) or bushing(s), at least 1.6 mm (1⁄16 in.)
thick, and of appropriate length and width installed to cover the area
of the wiring.
Exception No. 1: Steel plates shall not be required to protect rigid metal conduit, intermediate metal conduit, rigid nonmetallic conduit,
or electrical metallic tubing.
(2) Notches in Wood. Where there is no objection because of weakening the building structure, in both exposed and concealed
locations, cables or raceways shall be permitted to be laid in notches
in wood studs, joists, rafters, or other wood members where the cable
or raceway at those points is protected against nails or screws by a
steel plate at least 1.6 mm (1⁄16 in.) thick, and of appropriate
length and width, installed to cover the area of the wiring. The steel
plate shall be installed before the building finish is applied.
Exception No. 1: Steel plates shall not be required to protect rigid metal conduit, intermediate metal conduit, rigid nonmetallic conduit,
or electrical metallic tubing.

Building codes dictate how large the holes and notches can be.
International Residential Code (IRC)

Any stud may be bored or drilled, provided that diameter of the
resulting hole is no more than 60% of the stud width and the edge of
the hole is no more than  5/8” to the edge of the stud, and the hole
is not located in the same area as a cut or  notch.  Studs located in
exterior walls or bearing partitions drilled over 40% and up to  60%
shall also be doubled with no more than 2 successive doubled studs
bored.


Which means for bearing walls with 2x4 studs, the maximum hole diameter is 1 3/8&quot; and maximum notch depth is 7/8&quot;.  For a non-bearing wall with 2x4 studs, the maximum hole diameter is 2 1/8&quot; and maximum notch depth is 1 3/8&quot;. For bearing walls with 2x6 studs, the maximum hole diameter is 2 3/16&quot; maximum notch depth is 1 3/8&quot;. For non-bearing walls with 2x6 studs, the maximum hole diameter is 3 5/16&quot; maximum notch depth is 2 3/16&quot;.
Check local codes for amendments before proceeding. It might also be a good idea to consult with an engineer, to insure structural integrity is maintained.