I'm a newbie in Python. And I don't know how to run a python package with only one command line. I have been searched it on GG but I have no key-word. There is my folder:
├── config.json └── my_source ├──__init__.py ├──filter.py └──get_new_users.py
And config.json contains 3 parameters and able change by the user. So, I want to run this my_source package with one command line like this:
my_source -c config.json
Could I able to run my code in this way? If it's possible. Could anyone give me a key-word or a way to do it? If you need more info, please leave a comment. Thank you.
It's not clear what you mean "run a folder". Rather you can import the folder as a module, in other code, say
├── config.json ├── app.py └── my_source ├──__init__.py ├──filter.py └──get_new_users.py
from my_source import * within
app.py to use the function/variables defined there
python app.py, and pass
config.json somehow depending on the internals of that code
To run a python module/package specify the -m flag.
For example in your situation it will be something like:
python -m my_course.filter
See this SO question for more info.