I have a very simple situation where I am trying to import a function from another PY file in my views.py file.
Here is the code in the utils.py file…
def greet(name):
print('Hello ' + name)
In my views.py file I am using the following import statement…
from utils import greet
I am attempting to call the greet() function from this function in views.py.
@login_required(login_url='login')
def connect_to_dropbox(request):
greet('Hello!')
When I run this, I get the following error…
File "C:\Users\bob\Documents\Python-Django\Ursus\DropboxUI\views.py", line 3, in <module>
from utils import greet
ModuleNotFoundError: No module named 'utils'
The utils.py and the views.py are both in the same folder within the application. I use PyCharm as my IDE and it does not indicate any syntax error in the editor.
Any ideas on why I’m getting ModuleNotFoundError here?
Thanks!
Bob