17:30 comes after 4:00, so anything with start <= x <= end
will evaluate to false, because it implies that end (4:00) is larger than start (17:30), which is never true.
What you must do instead is check whether it’s past 17:30 or it’s before 4:00:
import datetime
now_time = datetime.datetime.now().time()
start = datetime.time(17, 30)
end = datetime.time(4, 00)
if now_time >= start or now_time <= end:
print('true')
else:
print('false')
2
solved How to check if time is in the range between two days?