I have a filestructure that looks like this:
script.py plugins |_ __init__.py |_ custom |_ __init__.py |_ test.py
test.py is just a simple test script that looks like this:
def main(): print('hello world')
within script.py I attempt to import test and run main():
from sys import path path.append('./plugins/') from plugins import custom custom.test.main()
But then I get a lovely AttributeError saying:
AttributeError: module 'plugins.custom' has no attribute 'test'
If I import test by name such as:
from sys import path path.append('./plugins/') from plugins.custom import test test.main()
It works fine, however since I have about 100 modules this isn’t really possible. Star imports also do not work and throw a name error:
NameError: name 'test' is not defined
Any help would be appreciated!