0

I found this question helpful, but Python is unable still to find the folder.

I have a Django folder structure that looks like this:

  • todoproject
    • pythonDiscordChatbot
      • processLessons.py
    • todoapp
      • testChatFunctions.py

I'm trying to import a function called 'routes' into testChatFunctions.py, but I keep getting this error:

 File "c:\Users\Kaij\Documents\chatSiteDjango\todoproject\todoapp\testChatFunctions.py", line 6, in <module>tSiteDjango\todoproject\todoapp\tesssLesson import *tChatFunctions.py", line 6, in <modd 'pythonDiscordChatbot'ule> atSiteDjango> & C:/Users/Kaij/Documents/djangoTests/django_tailwind_project/env/Scripts/ from pythonDiscordChatbot.procechatSiteDjango/todoproject/todoapp/testChatFunctions.pyssLesson import * ModuleNotFoundError: No module nametSiteDjango\todoproject\todoapp\testChatFunctions.py", line 6, in <module>d 'pythonDiscordChatbot 

Here's what I have tried:

# Bring your packages onto the path import sys, os sys.path.append(os.path.abspath(os.path.join('..', 'pythonDiscordChatbot'))) # Now do your import from pythonDiscordChatbot.processLesson import * # from pythonDiscordChatbot.processLesson import routes routes("hello", "website_180.02.1") 
2
  • 1
    have you tried adding __init__.py file in the pythonDiscordChatbot folder? Commented Nov 19, 2021 at 13:55
  • I really don't think you should need to add an init.py file. Also, is the error actually coming out exactly like that? Because it seems odd to have what looks like 2 separate strings randomly jumbled together like that. Commented Nov 19, 2021 at 14:05

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.