Adding 240v (NEMA 14-50) outlet right behind breaker panel
You can do this it takes a simple bushing or clamp from the main panel. Since the cable is breaker protected as long as it is protected going out of the panel and into the new one it is code compliant. Well if you have a permit,