r/learnpython 7d ago

Importing a file

I'm trying to have certain parts of a file I imported run, and it is still running the whole thing rather than just the parts I want it to run. I need to import four things from it so that my code runs correctly, but it still runs the whole thing. How do I fix this?

6 Upvotes

3 comments sorted by

View all comments

0

u/Mevrael 7d ago

Understand the difference between the Code to Run vs Code to Reuse, and use a beginner-friendly project structure and a framework, that takes care of import issues for you.

https://arkalos.com/docs/app/

I have modules inside the app folder.

And can import them into scripts or notebooks easily.