I have my target.py file in Starterpack/ModulesAndPackages/target.py
and I have my script file in Starterpack/Scripts/Bad.py
My ModulesAndPackages
folder has the __init__.py
file but I still get this error No module named ModulesAndPackages
when I type from ModulesAndPackages.target import Target
in the script file.
I've tried the sys.path.append()
and sys.path.insert()
but none worked. In my editor there is no error but when I run it, it gives the error.
script file:
mandp_dir = "./ModulesAndPackages"
scripts_dir = "./Scripts"
main_dir = ".."
os.chdir(Path(main_dir))
from ModulesAndPackages.target import Target
target.py file:
import time
import os
import keyboard
class Target():
def __init__(self, ip, port, packetsize, time=None):
self.ip = ip
self.port = port
self.packetsize = packetsize
self.time = time
def attack(self):
pass
I expected it to work if I added the __init__.py
file, but it doesn't.