ModuleNotFoundError - Ex40a

Code written for Ex40a:

import mystuff
mystuff.apple()
mystuff.py file contains 
# this goes in mystuff.py
def apple():
  print("I am apples")

mystuff.py was stored in the same folder as the ex40a.py file

Can anyone help to explain why I get a ‘ModuleNotFoundError’?

First do:

ls -l

And make sure that it really is there. Then, if it won’t pick it up, do this:

export PYTHONPATH=.

That’s if you’re on OSX or Linux. If you’re on windows use these instructions:

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_environment_variables?view=powershell-6

To set the same path:

$Env:path = $env:path + “;.”

Let me know if that works.

ls -l showed both files.
I did export
PYTHONPATH=.
anyway.
It all worked.

Thank you so much for taking the time to look at this! Much appreciated!

Ok, that’s a pretty common cause so just remember that in the future. Also, be sure it’s:

export PYTHONPATH=.