I've written a program (A) that takes, as input, the names of functions I wrote in a separate program (B). I want to use these functions in program (A), so I am trying to run (A) by doing this: A(f1, f2, f3, f4)
At the top of (A), I imported program (B) using import B. In (A) there is just one function (excluding main) that accepts four inputs (f1, f2, f3, f4), and then uses them, like this:
for i in range(x, y):
z = B.f1(i)
u = B.f2(i)
...
...
The trouble is, when I try to run A(f1, f2, f3, f4), I get the error
Traceback (most recent call last):
File "<pyshell#0>", line 1, in <module>
A(f1, f2, f3, f4)
NameError: name 'f1' is not defined
I see that python is not recognizing the functions in (B) as input in (A), but I don't know why or how else I can connect the two programs.
Update: Program A
def A(f1, f2, f3, f4) :
x = 0
y = 10
for i in range(x, y):
x = B.f1(i) //returns float
plt.plot(i, x)
...
A(from terminal, I assume?)