Jan-18-2020, 07:37 AM
(Jan-17-2020, 09:45 PM)IILawrenceII Wrote: Importing doesn't seem to work.
How do I read the files and use the data in the program?
...You import it. That's the exact answer to your question. Are you following a tutorial for your game? How are you trying to learn Python?
How does it not work? Do you get an error? The files need to be .py and they need to be in the same folder. If you have one file called
main.py
and another called player.py
, and the main.py
contains the lineimport player or from player import *Everything below the import statement can see it just as if it were in the same file. Importing it isn't going to run anything, if that is what you were wanting.
If that doesn't work then something is wrong with the code you are trying to run and you'll have to post it here to see.