Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7082147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:00:38+00:00 2026-05-28T07:00:38+00:00

While programming under eclipse+PyDev and using Flask framework, I noticed that the auto-organizing imports

  • 0

While programming under eclipse+PyDev and using Flask framework, I noticed that the auto-organizing imports feature from IDE (invoked with Ctrl+O) sometimes gets in the way.

This is related to the way Flask deals with the need of splitting views code into multiple modules, or packages. Basically, if you have a views.py module that contains your request handlers:

from myapp import app

@app.route('/')
def root():
    return "Hello world"

and your Flask app is defined in __init__.py:

from flask import Flask

app = Flask('MyApp')
app.config.from_pyfile('config.py')

@app.before_request
def before_request(): pass # omitted for brevity

@app.teardown_request
def teardown_request(): pass # omitted for brevity

you need to import views at the end of the latter file for the view functions to be added to Flask’s routing table. Since views.py imports __init__.py to access the app variable, this results in circular import. It works fine, though, and is in fact an established practice, as suggested by documentation.

Unfortunately, PyDev knows nothing about this technique. Should we accidentally trigger organizing imports for __init__.py (not uncommon, given how useful this option is in general), PyDev will happily move the crucial import views to the top. Of course, this results in incorrect (irresolvable) circular import, and an annoying runtime error.

Is there a way to prevent this from happening – like a #@Directive that would tell PyDev to leave this specific import alone, a way to turn off import organizing on per-file basis, or something similar?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:00:38+00:00Added an answer on May 28, 2026 at 7:00 am

    I don’t use PyDev, but have you tried throwing off its import parser? This is dirty, but you could try something like:

    if 1: import views
    

    Since the line doesn’t begin with “import”, maybe PyDev will pass it over?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've just started using ASP, so while programming the code behind in C# I
I'm programming a GUI in Java (using Swing of course) and while running my
I'm quite fond of using GNU getopt , when programming under Linux . I
Hey, while programming stuff, I have found that it is often very helpful to
While doing concurrent programming I need to tell the compiler/optimizer that it may not
I'm learning Java and OOPS and while programming a basic Hello World in eclipse,
While programming, the longest part is a build on my ASP.NET Website project is
This question occured to me while programming a Android application, but it seems to
Sometimes I need to learn the type of an expression while programming in C
What specific techniques have you found to learn keyboard shortcuts while programming? I don't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.