I understand how to actually link python files, however, i don’t understand how to get variable’s from these linked files. I’ve tried to grab them and I keep getting NameError.
How do I go about doing this? The reason i want to link files is to simply neaten up my script and not make it 10000000000 lines long. Also, in the imported python script, do i have to import everything again? Another question, do i use the self function when using another scripts functions?
ie;
Main Script:
import sys, os
import importedpyfile
Imported Py File
import sys, os
How are you doing that? Post more code. For instance, the following works:
file1.py
file2.py:
Nope, modules should be imported when the python interpreter reads that file.
Nope, that’s usually to access class members. See python self explained.
There is also more than one way to import files. See the other answer for some explanations.