0
votes

I'm struggling to import a folder that has many engines I need to use. I'm importing from main_file.py. So I think I can use - from engines import qr_code_gen, but I need to import a class which is named _QRCode_ so I tried using - from .engines.qr_code_gen import _QRCode_, but it says "module engines was not found".

Structure:

Server/start.sh
Server/wsgi.py
Server/application/main_file.py
Server/application/engines/qr_code_gen.py
Server/application/engines/__init__.py
...

I used sys.path in main_file.py and I got -

['C:\Users\Dzitc\Desktop\winteka2', 'C:\Users\Dzitc\AppData\Local\Programs\Python\Python37\Scripts\flask.exe', 'c:\users\dzitc\appdata\local\programs\python\python37\python37.zip', 'c:\users\dzitc\appdata\local\programs\python\python37\DLLs', 'c:\users\dzitc\appdata\local\programs\python\python37\lib', 'c:\users\dzitc\appdata\local\programs\python\python37', 'C:\Users\Dzitc\AppData\Roaming\Python\Python37\site-packages', 'c:\users\dzitc\appdata\local\programs\python\python37\lib\site-packages', 'c:\users\dzitc\appdata\local\programs\python\python37\lib\site-packages\win32', 'c:\users\dzitc\appdata\local\programs\python\python37\lib\site-packages\win32\lib', 'c:\users\dzitc\appdata\local\programs\python\python37\lib\site-packages\Pythonwin']

1
Do you have an __init__.py file in your application directory?Azamat Galimzhanov
@AzamatGalimzhanov yesDzITC
Is winteka2 where you app is located?Azamat Galimzhanov
What do you get if you just import engines?Azamat Galimzhanov
lmao, I change the name - 'engines' to - 'engine', moved the folder to Server/application/api/ and used this import - from application.api.engine.qr_code_gen import _QRCode_, and now it worksDzITC

1 Answers

1
votes

Going from comments you can import engine package.

Try this then:

import engines

engines.qr_code_gen._QRCode_