Your dark attic is a real attractive place for bats to roost and create into a colony. Nah. Don’t think Batman. Batman’s bats roosted in a cave beneath his mansion, not in an attic of a three bedroom home in the suburbia.
Bats can get in through the small openings and gaps in your home so your best bet is to seal them by applying caulk, weatherstrips, or screens. Just leave one possible opening so that the bats can leave your home as night strikes. Seal the opening a half an hour after dark. If you can’t possibly seal of small opening without remodeling your home, try shining a light at their roosting are by installing a bright light. Another trick is to hang mothballs in porous bags (another use for old stretchy stockings) to ward them off.
If, by any chance, a bat finds itself in your home after dark, here’s a neat trick: open all the possible exits points it can have (windows and doors) and turn off all the light inside your home. The bat will most likely fly out.