Apply to x function adding lots of imports

In python, using chat, and applying to a function, a bunch of extra imports are being added to the function itself. none are needed, and it’s the wrong place for it.

Using gpt-4o in the chat