In an interplanetary mission, a spaceship travels through deep space, where the temperature is almost zero degrees Kelvin, and it is likely that its electronic circuits get permanently damaged. How are the electronic circuits in the spaceship kept warm?
Space in the vicinity of the Sun is not that cold, perhaps even out to Jupiter. One side of the spacecraft will be receiving sunlight while the side shielded from sunlight radiates into empty space. One simple solution to this is to put the vehicle into barbecue mode: The vehicle is made to slowly rotate, thereby preventing one side from getting too hot and the other side from getting too cold. This doesn't work if the spacecraft is supposed to be doing something else, but most of the time during the trajectory from one planet to another the spacecraft isn't doing something else.
In addition to barbecue mode, spacecraft use a wide range of passive and active thermal control techniques to combat the excessive heating from the Sun and excessive cooling due to radiation to empty space. These include
Internal heaters. In some cases, spacecraft have electric heaters whose only job is to convert electrical energy into thermal energy. In other cases, there's no need for such a device because one of the byproducts of computing and other uses of electrical power is to generate heat. Think of how often your laptop gets so hot you have to remove it from your lap.
Coatings of various types (i.e., high tech paint). Paints can have very different behaviors in the visible spectrum of light, the near-infrared, and the thermal infrared. Areas of spacecraft that nominally point at the Sun can be coated with paint that is highly reflective in the visible and near infrared portions of the electromagnetic spectrum. Areas that nominally point away from the Sun can be coated with paint that is either highly reflective or highly absorptive in the thermal infrared, depending on whether the spacecraft has a problem with too much cooling or too much internal heating.
Multi-layer insulation (MLI). When it gets cold outside some people turn up the thermostats in their houses. Others turn them down to avoid high electric bills. Those other people simply use more blankets to sleep comfortably at night. Multi-layer insulation is a high tech layer of multiple blankets.
Thermal radiators. Getting too hot is oftentimes a more significant problem than is getting too cold for many spacecraft. In some cases, passive thermal control techniques don't suffice for spacecraft that have a tendency to get too hot. These spacecraft use thermal radiators intentionally designed to radiate excess thermal energy into empty space. For example, the International Space Station has a very complex active thermal control system that involves fluids circulated between thermal radiators and the body of the ISS. In addition to the circulation mechanisms, the thermal radiators are rotated so as to keep the radiators close to edge-on to the Sun. This rotation requires that the connection between the radiators and the body of the ISS is rather complex.