First, you should decide whether you want to use an absolute or relative import.
Absolute imports make python search for the path in all directories listed in sys.path (or equivalently PYTHONPATH env variable), most commonly the top level directory, or an installed package, or a standard library module.
If the parent folder is inside the top level directory, then these are absolute options:
# file2.py
import parent.file1
from parent import file1
from parent.file1 import foo
This approach is more explicit and often much clearer for simple file structures, than relative imports.
Relative imports are what they sound like: an import relative from the file youâre in. A dot . basically represents going backwards into the containing folder.
# file2.py
from .. import file1
from ..file1 import foo
# The ".." represents "parent" folder.
# The first dot is the "child" folder
# The second dot is the folder that "child" is in: the "parent" folder
Oh, I know why. You have to put disableGuessImports = true at the top of your .replit file. You might have to unhide it via the three dots and then select Show hidden files.