from bar import MY_CONST, add def main(): print(MY_CONST) print(add("Test", 10)) if __name__ == "__main__": main() MY_CONST = [4, 2] def add(x, y): if not isinstance(x, int): print("Keine Zahl!") return return (x+y)/x if __name__ == "__main__": print("Hallo aus bar.py") from utils import add from utils.basicmath import sub, mult, div from utils.stringopts import get_length, reverse, does_include # 1 + 2 print(add(1, 2)) # 12 / 4 print(div(12, 4)) # Länge von "Teststring" print(get_length("Teststring")) # Ist "tier" in "Raubtier"? print(does_include("Raubtier", "tier")) # Funktionen für Matheoperationen def add(x, y): return x + y def sub(x, y): return x - y def mult(x, y): return x * y def div(x, y): return x / y # Relativer import, um module-Pfad zu sparen from .basicmath import add def get_length(word): return len(word) def reverse(word): return reverse(word) def does_include(word, substring): # Gibt True/False zurück return (substring in word)