def load() doesnt work across multiple files?
Posted: Mon Mar 19, 2018 8:55 am
Hey,
Just noticed that my function on load, which is not the main project file, doesnt get called.
test.py
test_file.py
When I try to load the plugin..
Is this intended? Is there a workaround?
My only guess to work this around, would be to add:
test_file.py
But if there would be a function in load() which gets called instead of print('...'), it would throw most likely a NameError, which would lead that it has to be added at the very end of a file, which looks bad in syntax.
Just noticed that my function on load, which is not the main project file, doesnt get called.
test.py
Syntax: Select all
from . import test_file
def load():
print('Hello World')
test_file.py
Syntax: Select all
def load():
print('Hello Server')
When I try to load the plugin..
Code: Select all
[SP] Loading plugin 'test'...
Hello World
[SP] Successfully loaded plugin 'test'.
Is this intended? Is there a workaround?
My only guess to work this around, would be to add:
test_file.py
Syntax: Select all
def load():
print('Hello Server')
load()
But if there would be a function in load() which gets called instead of print('...'), it would throw most likely a NameError, which would lead that it has to be added at the very end of a file, which looks bad in syntax.