In this article, we provide our perspective on optical nanosensor design and the challenges to efficiently create sensors with a desired performance. This is, in our opinion, the central challenge because it determines how far sensors can be optimized, how deep our understanding of molecular recognition goes, and whether machine learning methods can be efficiently applied. One particularly well-suited class of nanomaterials are single-walled carbon nanotubes (SWCNTs).