modul example

This commit is contained in:
Troy Grunt 2024-11-22 12:23:37 +01:00
parent 90e0cf3d94
commit f0a7fd9ed6
3 changed files with 25 additions and 1 deletions

View File

@ -1,4 +1,4 @@
from .core import getOrg, getOrgMembers, getUser
#from .modules import *
from .modules import *
__all__ = ["getOrg", "getOrgMembers", "getUser"]

16
sccpy/modules/__init__.py Normal file
View File

@ -0,0 +1,16 @@
# modules/__init__.py
# Importiere Untermodule dynamisch
import os
import importlib
# Automatisch alle Python-Dateien im modules-Ordner als Untermodule laden
__all__ = []
modules_dir = os.path.dirname(__file__)
for filename in os.listdir(modules_dir):
if filename.endswith(".py") and filename != "__init__.py":
module_name = filename[:-3]
module = importlib.import_module(f"sccpy.modules.{module_name}")
globals()[module_name] = module
__all__.append(module_name)

8
sccpy/modules/example.py Normal file
View File

@ -0,0 +1,8 @@
# example.py
def exampleFunction():
"""
Example function in a module.
:return: A string message.
"""
return "This is an example function from a module."