import .py project to another project
On 6/11/2019 at 10:11 PM, Slottr said:You'll need the py file it in the same project folder
False. Its most user friendly for beginners thats true but you can import files from anywhere. You can even import folders. Actually most modules are folders that have python files in them. I will show example of json module.
Bit of explaning. For someone who plans to advance in python.
When you create __init__.py file in folder, you are telling python that folder is module.
For example here is json module.
http://prntscr.com/o21qkw
And if we import json, and do dir(json) we will get content of that folder
http://prntscr.com/o21re8
Oher stuff that we got in dir are located in tools.py and __init__.py
for example here is dumps code: http://prntscr.com/o21so0
There is a lot of flexibility with designin and organising objects, functions, modules with python.
test it out, have fun. Cheers.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now