Home:ALL Converter>Accessing a python script in a different folder, using a python script

Accessing a python script in a different folder, using a python script

Ask Time:2014-11-18T20:43:32         Author:pycrazy

Json Formatter

Can a python script located in D:\Folder_A\Folder_B\be used to change variables in another python script located in D:\Folder_A\Folder_C\, and then print them out on the console?

NOTE: I'm a beginner in Python, and I'm using v2.7.8.

EDIT: To answer @Rik Verbeek, I created a python file in location A (D:\Folder_A\Folder_B\), and another file at location B (D:\Folder_A\Folder_C\), with both the folders (Folder_B & Folder_C) located in D:\Folder_A\. In the 2nd .py file, I wrote the following:

a = 0 b = 0

Now I want to change these variables from the 1st .py file to 5 and 10 respectively, and print them to the console. Also, these files are not in the Python libraries, but are instead, located in another folder(Folder_A).

To answer @Kasra (and maybe @cdarke), I don't want to import a module, unless it is the only way.

Author:pycrazy,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/26994651/accessing-a-python-script-in-a-different-folder-using-a-python-script
yy