Fehler beim Import von localem Modul
Verfasst: Mittwoch 28. Oktober 2020, 11:21
Also ich versuche seit stunden ein Modul, welches in einem subdirectory des aktuellen files befindet, zu importen. Ich verstehe ehrlich gesagt nicht ganz was ich falsch machen...Ich habe es mit einer Methode zu laufen gebracht jedoch kommt die IDE und meckert dann mit folgender Fehlermeldung:
Der zweite Versuch schlug komplett fehl...dort kam diese Fehlermeldung:
Die Verzeichnisstruktur ist die folgende:
Das ist die Embeds Klasse:
Die __init__.py ist eine leere Datei 
Ich bedanke mich schonmal im vorraus für eure Hilfe
Code: Alles auswählen
from .utils.embeds import Embeds
Code: Alles auswählen
Attempted relative import beyond top-level package
Code: Alles auswählen
import utils.embeds as embeds
Code: Alles auswählen
Extension 'cogs.workgroups' raised an error: ModuleNotFoundError: No module named 'utils'
Code: Alles auswählen
workgroups.py
./utils
embeds.py
__init__.py
Code: Alles auswählen
import discord
class Embeds():
@staticmethod
def warning(information_body):
return discord.Embed(
title = "Kick Alert",
description = information_body,
color = discord.Color.red()
)
@staticmethod
def information(information_body):
return discord.Embed(
title = "Information",
description = information_body,
color = discord.Color.blue()
)
@staticmethod
def ban():
return discord.Embed(
title = "Ban Alert",
description = "You have been banned by a Admin or Moderator.",
color = discord.Color.red()
)
@staticmethod
def kick():
return discord.Embed(
title = "Kick Alert",
description = "You have been kicked by a Admin or Moderator. You can re-join the Server via a Invite Link.",
color = discord.Color.dark_orange()
)

Ich bedanke mich schonmal im vorraus für eure Hilfe
