I have the following project structure:
project
├───resources
│ │
│ ├── __init__.py
│ ├── constants.py
│ │
│ ├── folder1
│ │ ├── __init__.py
│ │ └── helper2.py
│ │
│ └── folder2
│ ├── __init__.py
│ └── helper2.py
│
└───tests
└── test1.robot
constants.py contains variables, that are used by different helper methods in folders. I import them as
from constants import *
Tests are in Robot Framework.
When I run them locally, I use VScode and RobotCode extension. And here I don’t have any issues, constants are imported and used correctly.
But when I try to run tests from the command line:
python -m robot tests
I receive error with this import:
ModuleNotFoundError: No module named ‘constants’
If i try import:
from .constants import C1
I receive:
attempted relative import with no known parent package
How should I import the constants properly?