This article demonstrates how scientists and engineers can use modern AI (artificial intelligence) tools such as ChatGPT and GitHub Copilot to learn computer programming skills that are relevant for their jobs. It begins by summarizing common ways that AI tools can already help people learn programming in general. Then it presents six learning opportunities that are catered to the needs of scientists and engineers, including using AI tools to 1) create customized programming tutorials for one’s own domain of work, 2) learn complex data visualization libraries, 3) learn to refactor exploratory code into more maintainable software, 4) learn about inherited legacy code, 5) learn new programming languages on-demand within the context of one’s workflow, and 6) question the assumptions that one’s scientific code is making. Taken together, these opportunities point toward a future where AI can help scientists and engineers learn programming on-demand within the context of their existing real-world workflows.