Make importing all modules easier

It is exhausting to repeat the word “import” like sending data from modules one by one
So i really want to get all .py modules at once (send data to all modules quickly) with creating a variable named pyModules (gets all python modules)

# module 1
def sendData(text: str) -> None:
    import pyModules # does not import the module, sends something
    return text.pyModules # Will not give the error

sendData("Apple ")

# module 2
print(str(module1.sendData) + str("Banana") # Automatic importing

Output on module 1
‘Apple Banana’

It’s really hard to understand your goal here, especially as Python doesn’t ‘send’ data to moduies at all.

1 Like

Something isn’t quite right here: If text is a string than text.pyModules will absolutely be raising an AttributeError.

Can you give a fuller example? Along with code that we can run? And I assume you mean “module 1” is in a file named module1.py?

1 Like