I am creating a project with so many modules, each module has helpers.py file that uses some functions from that file. here is my directory structure:
│ main.py
├───modules
│ │ __init__.py
│ ├───main
│ │ main.py
│ │ __init__.py
│ │
│ ├───network
│ │ │ helpers.py
│ │ │ network.py
│ │ │ __init__.py
│ │
main.py:
from modules.main import main
if "__main__" == __name__:
main()
modules/main/main.py:
import sys
sys.path.insert(0, 'J:\\Scanner\\modules')
import network.network as HostDiscovery
modules/network/network.py:
from helpers import ips
...
Whenever I try to run main.py in the root directory, I get the error:
from helpers import ips
ModuleNotFoundError: No module named 'helpers'
Each module works fine when I try running it alone, but when I run from main.py it fails with the error that it cant find helpers module. How can I achieve this without having to change the directory structure.
=would be a syntax error, and there are no "null pointers" to worry about -None == 'foo'simply (and correctly) evaluates toFalse.=is part of an assignment statement, which is not a kind of expression (unlike C and C++ where assignments are a kind of expression).