python - Run script from main script in spyder-project -


i have spyder-project 2 scripts: "mainscript.py" , "subscript.py". how can run "subscript.py" "mainscript.py" thing current workspace-variables? kind of command must use?

you should able call subscript.py within mainscript.py call file library. easier if contents of `subscript.py' within function.

e.g. if setup is:

project file - mainscript.py - subscript.py 

and subscript.py file like:

#imports     def some_function(some_variable):         #does here 

then in mainscript.py should able import , use it. e.g.:

from sub import some_function def main():     variable = 'some value'     some_function(variable) #should call function using variable     #rest of code  main() 

Comments

Popular posts from this blog

java - Static nested class instance -

c# - Bluetooth LE CanUpdate Characteristic property -

JavaScript - Replace variable from string in all occurrences -