[Backport maintenance/4.0.x] Assign import nodes to module locals if used with global (#2857) Assign import nodes to module locals if used with global (#2856) (cherry picked from commit 1afbca660c533a137382a46f20cd78cffca6c50a) Co-authored-by: Marc Mueller <30130371+cdce8p@users.noreply.github.com>