Lets say that I have a script, test.py, that has a function that it within another function:
x = 3
def function_1(x):
...
y = x + 7
def function_2():
return value
Now I want to use both function_1 and function_2 in another script. How do I do that?
I've tried this:
import test
from test import function_1
from function_1 import function_2
I basically just get an error saying No module named function_1. It does import function_1 and I can use it, but not function_2. I can't just make function_1 a class (it needs a parameter). How can I fix this? Can I somehow use _main_ to replace function_1? Could I then import just function_2?