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
Work on a project the utilizes a bunch of script create by another person, I like to avoid restructuring or modifying their code. So I need help figuring out how I handle imports correctly. In this case I having issue with relative imports. Usage doc lightly cover importing, where a main func call to a mod/child. I also currently using load at run-time', would also like to compile for portability eventually.
I've try a few permutations base on the usage doc with no luck.
Below a representation of what I'm working with. I making a Rust component for target.py—bunch of api request stuff— where it need to access a few functions from dep.py—gen headers, etc. I've test the the python code where I've move the dep.py snippets into target.py and it works but I like to keep the 2 separate for obvious reasons.
.
├── Cargo.lock
├── Cargo.toml
├── scripts
│ └ others.py
│ └── utils # working from here
│ └── __init__.py
│ └──dep.py # helper functions that target.py need to access.
│ └── target.py # This has the functions I need to run
│ └── other_target.py # several other like target that require dep.py
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
-
Work on a project the utilizes a bunch of script create by another person, I like to avoid restructuring or modifying their code. So I need help figuring out how I handle imports correctly. In this case I having issue with relative imports. Usage doc lightly cover importing, where a main func call to a mod/child. I also currently using load at run-time', would also like to compile for portability eventually.
I've try a few permutations base on the usage doc with no luck.
Below a representation of what I'm working with. I making a Rust component for
target.py
—bunch of api request stuff— where it need to access a few functions fromdep.py
—gen headers, etc. I've test the the python code where I've move thedep.py
snippets intotarget.py
and it works but I like to keep the 2 separate for obvious reasons.Head of
target.py
Beta Was this translation helpful? Give feedback.
All reactions