Skip to content
Advertisement

Calling Function’s return value to a script from another module?

I am new to the advanced problems of python. I am trying to get good if you want to make any correction it is welcomed.

I want to do run function in Run File. I can’t pass the return value of a function without altering its value.

Then assign fpath in the function firstfile.py to the secondfile.py script’s sav_img variable and be able to work inside of another function.

I need to do this beacuse i can only access to the run file. When i update repo.

Run Order

Run File

JavaScript

First File

JavaScript

Second File

JavaScript

Error on sav_img

JavaScript

sav_img = file_path.fpath doesn’t working either. I know i need to pass value but i don’t want to alter its value

Advertisement

Answer

One possibility is to get the function to save the return value when called with a parameter, but return the saved value when called with none.

First File

JavaScript

Second File

JavaScript

However, this relies on the first caller never using None as the parameter.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement