Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for multiple file programs #66

Open
JacobenVosloo opened this issue Sep 22, 2024 · 4 comments
Open

Support for multiple file programs #66

JacobenVosloo opened this issue Sep 22, 2024 · 4 comments

Comments

@JacobenVosloo
Copy link

Based on this PR #58

And the read me
Screenshot 2024-09-22 at 19 54 00

I would assume that splitting code into multiple files work

But based on my simple test it does not

Screenshot 2024-09-22 at 19 49 00

Can anyone please assist as to what am I doing wrong?
@GreenGitHub99

I also tried changing the settings to precompiled mpy file

Screenshot 2024-09-22 at 19 55 56
@PeterStaev
Copy link
Owner

@JacobenVosloo , could you please provide the contents of the main.assembled.py file (it should be in the same folder as your main.py file)?

@JacobenVosloo
Copy link
Author

JacobenVosloo commented Sep 23, 2024

@PeterStaev, thank you for the quick response.

The contents are the same as the main.py file.

# LEGO type:basic slot:0 autostart

# Use wildcard import for utilities
from utilities.py import *

# Now you can call battery_check directly
battery_check()

And the file is located in the same location as main.py and utilities.py

Screenshot 2024-09-23 at 07 35 29

@PeterStaev
Copy link
Owner

@JacobenVosloo I see your import in the assembled file looks different than the one in the main.py file - it hast the .py extension at the end of utilities. I think this is what causing the problems as the logic automatically adds the extension when it looks up the file to be assembled. Can you check and remove the extension so the import is:

from utilities import *

@JacobenVosloo
Copy link
Author

@PeterStaev

I double-checked, and import is now as you suggested. But it is still not working. Here is a screenshot showing the whole setup and the resultant main. assembled.py file.

Screenshot 2024-09-25 at 07 25 58

I am working of a Mac, could this be the problem?

Is there perhaps some example file that I can use to test the setup on my side.

Thank you again for the support and a great library

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants