0

First of all the project structure looks like this

-- ba-amin-code (main directory)
   -- Diverse
      -- LanguageIdentification.py
   -- TextAlignment
      -- FileHandler.py
      -- TextHandler.py

I want to import a python file from TextAlignment when im in Diverse.

Project Structure, import statements

This is how I imported it, but im getting this error when running it like this

enter image description here

Is this way wrong to import?

Update: This is how im importing two py files from TextAlignment.
Im in LanguageIdentification.py

import fasttext
import urllib
import typer
from TextAlignment import TextHandler
from TextAlignment import FileHandler

After that im running the program`from the root-directory (ba-amin-code) by console with this command
python Diverse/LanguageIdentification.py "INPUT.txt"

getting this error

Traceback (most recent call last):
  File "C:\Users\Snur\Pycharm Projects\Gitlab\ba-amin-code\Diverse\LanguageIdentification.py", line 4, in <module>
    from TextAlignment import TextHandler
ModuleNotFoundError: No module named 'TextAlignment'


1 Answers1

0

The package might be installed in a different venv. Did you try running your code from the pycharm console, with your venv activated?

You have two yellow warnings in pycharm at your imports: what are they?

Otherwise, try the command: $pip list to see if the package is correctly installed in your venv.