Q:

What is the time complexity of Python's os.path.exists()?

I have a ton of folders nested inside one another.
What is time complexity of Python's os.path.exists() ?
Does it change if used with different OS ?

A:

Given you are asking the OS if a single file exists, it does not need to do any algorithmic logic, or go down your path... I don't see how it could be anything else than O(1). 

