Lets say we have two programs A.py and B.py ,now B.py has two defined functions
calculator(x,y) which returns int and makelist(list1)which returnslist`
Now,how can I access these functions in A.py (Python 3)?
Lets say we have two programs A.py and B.py ,now B.py has two defined functions
calculator(x,y) which returns int and makelist(list1)which returnslist`
Now,how can I access these functions in A.py (Python 3)?
You will need to import the other file, that is B, as a module
import B
However, this will require you to prefix your functions with the module name. If instead, you want to just import specific function(s) and use it as it is, you can
from B import * # imports all functions from B
-or-
from B import calculator # imports only the calculator function from B
UPDATE
Python does not add the current directory to sys.path, but rather the directory that the script is in. So, you would be required to add your directory to either sys.path or $PYTHONPATH.