You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am unable to import local function/classes into the method.
Details:
Say, I have a file say
some_file.pydeffunction(x):
returnx*x
Now I am trying to import this file into the following file (They are located in the same folder):
file_to_be_deployed.pydefdeploy_function(x):
fromsome_fileimportfunction# This is what I want to doreturnfunction(x)
client.deploy('deploy_function',
deploy_function,
'Squares''x',
override=True
)
But This is throwing an error
Responding with status=500, message="Error querying function 'deploy_function'", info="{'uri': 'deploy_function', 'error': "ModuleNotFoundError : No module named 'some_file.py'", 'type': 'QueryFailed'}"
What I Tried:
So, I tried deploying the some_file.py onto the server, even then I got the same issue as above.
I looked up solutions for this, but none of them used another file as an import.
So, for now, I am writing the function(x) in every file I need it. But this defeats the purpose of me having a separate file for it.
file_to_be_deployed.pydeffunction(x):
returnx*x# This is what I am doing nowdefdeploy_function(x):
returnfunction(x)
client.deploy('deploy_function',
deploy_function,
'Squares''x',
override=True
)
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Issue:
I am unable to import local function/classes into the method.
Details:
Say, I have a file say
Now I am trying to import this file into the following file (They are located in the same folder):
But This is throwing an error
Responding with status=500, message="Error querying function 'deploy_function'", info="{'uri': 'deploy_function', 'error': "ModuleNotFoundError : No module named 'some_file.py'", 'type': 'QueryFailed'}"
What I Tried:
So, I tried deploying the
some_file.py
onto the server, even then I got the same issue as above.I looked up solutions for this, but none of them used another file as an import.
So, for now, I am writing the
function(x)
in every file I need it. But this defeats the purpose of me having a separate file for it.What can I do to achieve it?
Beta Was this translation helpful? Give feedback.
All reactions