Re: splitting my python code into multiple .py files like in bgt
Na, you're messing keywords up a bit here. A single file is a module, a folder however is a package and needs to contain a __init__.py file (it may be empty) so you can import modules from it.
You also need to import a module to access its functions, or import the modules in the __init__.py file of the package.
So you have multiple options. Either you go with the following, what i'd still recommend:
from includes import test
from includes import module
from includes import my_test_module
# you can combine multiple imports as follows
from includes import (
test,
module,
my_test_module)
# now you can access all the functions test.my_test() module.initialize() my_test_module.do_something()
Or you can do the following:
includes/__init__.py:
from . import test
from . import module
from . import my_test_module
main.py:
import includes
includes.test.my_test()
# ... etc
# you can also do
from includes import *
test.my_test()
# ... etc
As you can see, there are always multiple ways to go, the only requirement is that you're doing it the correct way.
Best Regards.
Hijacker
-- Audiogames-reflector mailing list Audiogames-reflector@sabahattin-gucukoglu.com https://sabahattin-gucukoglu.com/cgi-bin/mailman/listinfo/audiogames-reflector