This study compares insulin icodec, an insulin taken once a week to insulin glargine, an insulin taken once a day. The study medicine will be investigated in participants with type 1 diabetes. The study will look at how well insulin icodec taken weekly controls blood sugar compared to insulin glargine taken daily. The study will last for about 8.5 months.