Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

how can i import my own .py file and use this in the script node? #1918

Answered by OmarEmaraDev
luckychris asked this question in Q&A
Discussion options

i have written a function in another text (.py) file and want to import this in a .py file which i want to use in a script node.

So basically my script .py file looks like this:

import driverFunctions
return driverFunctions.getTargetRelativeToCar(wantVector=True)

But i got the error:

image

how can i realize this?

You must be logged in to vote

I think the Blender way to do that would be:

driverFunctions = bpy.data.texts['driverFunctions.py'].as_module()

Replies: 1 comment 1 reply

Comment options

I think the Blender way to do that would be:

driverFunctions = bpy.data.texts['driverFunctions.py'].as_module()
You must be logged in to vote
1 reply
Comment options

Thank you very much Omar, i didn't know that method at all and it worked like a charm!!!

Answer selected by OmarEmaraDev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
Converted from issue

This discussion was converted from issue #1917 on May 13, 2023 10:07.

AltStyle によって変換されたページ (->オリジナル) /