Skip to content

Automatically import when user shift+enter to use methods before actually importing #22329

@TylerLeonhardt

Description

@TylerLeonhardt

Testing #22287

import string

for letter in string.ascii_lowercase[::-1]:
    print(letter)

If I haven't shift+enter on import string yet and I go to shift+enter on the for loop, I get:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'string' is not defined

which makes sense based on the TPI... however, as a suspect some folks may have large files with many imports at the top, it'd be nice if those imports were automatically run.

Metadata

Metadata

Assignees

No one assigned

    Labels

    feature-requestRequest for new features or functionality

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions