from filename import variable_name
No need to add the .py extension when adding the filename.
If you’d like to import everything from that file you can do
from filename import *
However, this isn’t best practice as you might get a warning saying pyflake isn’t sure if the variable name is imported or not.
You can also import the file and add the file name when using that variable.
import filename
print(filename.variable_name)
Have any questions or comments? Write them below!