0

I have a directory application in which I have two files. init.py and routes.py. I have set a variable in init.py. while I am one directory below package directory application , I am able to import the variable.

>>> from application  import hello_api_blueprint 
>>> hello_api_blueprint 
<flask.blueprints.Blueprint object at 0x7f4d6869da10>

But when I am inside package directory - application I am not able to import with multiple way

>>> from application  import hello_api_blueprint
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named application
>>> from .  import hello_api_blueprint
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ValueError: Attempted relative import in non-package

How can I import this variable when I am inside the directory.

Bharat Sharma
  • 1,081
  • 3
  • 11
  • 23

0 Answers0