I'm running into a problem with a program I'm creating and I can't figure out why I'm receiveing this error. I'm sure it something simple and I've just been working on it to long and my eyes need a rest.
My directory layout is this:
/home/my_username/My Programs/my_program
my_program
├── __init__.py
├── plugins
├────└── __init__.py
├──────└my_plugins
├─────────└── __init__.py
├─────────└── activate.py
├─────────└── messages.py
Here is my code in messages.py
-----messages.py-----
welcome_msg = "Hello, thanks for trying my program."
Here is my code in activate.py
-----activate.py-----
import plugins.my_plugins.messages as m
print(m.welcome_msg)
I'm using PyCharm and the program works just fine in PyCharm and show no errors.
Outside of PyCharm when I run:
python3.9 activate.py
I receive this error
ModuleNotFoundError: No module named 'plugins'
If I change activate.py to look like this, it works in the terminal outside of PyCharm but then inside PyCharm I receive an error "No module named messages" BUT! when I run it in PyCharm with the error it works. It picks up messages.py module and displays the correct text.
-----activate.py-----
import plugins.my_plugins.messages as m
print(m.welcome_msg)
I'm self teaching my self Python. Is there some kind of snippet that tells Python where the base directory is. In this example that my_program is the base directory? Or should I just ignore PyCharm error? I've never ignored an error that PyCharm has given so that would be a first.
Thanks in advance for your time in helping me with this problem.
Ps. Please excuse any spelling or grammar mistakes I was born with severe dyslexia.