1๐
I recommend to split script.py
into two parts:
- a module that exposes a function that does something with model instances
- a command that imports that module and runs the function with command-line arguments
Then you can just import the function both from the view and from the command-line script. A function call sounds more convenient and efficient compared to spawning a separate python process and passing all parameters through command line.
๐คKos
Source:stackexchange.com