Problem when trying to import a template from a django directory

I have a django module called botmodules, for example, and I want to import a model from a django module into it.
Look how I proceeded

Traceback (most recent call last):
  File "/code/botmodules/bot.py", line 1, in <module>
    from events import general
  File "/code/botmodules/events/general.py", line 2, in <module>
    from ...botlogic.models import Server
ImportError: attempted relative import beyond top-level package

enter image description here

There are two easy and straight forward ways of handling situations like this.

  • Create your code as an installable package and install it in your virtual environment.

  • Copy the code into your Django project directory.

See the recent discussion here: How to set up an app folder outside a project folder?