Nov-27-2019, 09:39 PM
I'm trying to split my code into separate modules: sprites.py, setting.py, etc. I'm clearly missing something.
from settings import * print(tile_size)This doesn't work, though I think it should.
Error:Traceback (most recent call last):
File "C:\Users\owner\Desktop\Python3\DungeonGame\levels.py", line 2, in <module>
print(tile_size)
NameError: name 'tile_size' is not defined
If I spell the file wrong, like "sttings", I getError:Traceback (most recent call last):
File "C:\Users\owner\Desktop\Python3\DungeonGame\levels.py", line 1, in <module>
from sttings import *
File "C:\Users\owner\AppData\Local\Programs\Thonny\lib\site-packages\thonny\backend.py", line 305, in _custom_import
module = self._original_import(*args, **kw)
ModuleNotFoundError: No module named 'sttings'
I have all the python files in the same directory and setting.py's first line is "tile_size = 50" Python can see that the file exists but "import" doesn't make it visible.