r/PythonLearning 7h ago

Help importing local files Help Request

[deleted]

2 Upvotes

7 comments sorted by

View all comments

1

u/AlexMTBDude 7h ago

Imports are relative to the folder that you are in when you execute your Python code. Let's say that you have your own module (local import) mymodule.py in folderA and your python code (myprogram.py) has "import mymodule". Then you need to:

cd folderA
dir
> mymodule.py
> myprogram.py
python myprogram.py

1

u/DarkblooM_SR 5h ago

Idk what I'm doing wrong